容器执行ping命令报错解决:ping: command not found

容器使用ping命令报错

报错提示

在这里插入图片描述

解决方法

  1. 进行更新
apt-get update
 1. root@pod2:/# apt-get update
 2. Hit:1 http://deb.debian.org/debian bookwormInRelease
 3. Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
 4. Hit:3 http://deb.debian.org/debian-security bepokworm-security InRelease
 5. Fetched 55.4 KB in 1s (101 kB/s)
 6. Reading package lists... Done
  1. 安装工具
1.apt install iputils-ping
3. root@pod2:/# apt install iputils-ping
4. Reading package lists... Done
5. Building dependency tree... Done
6. Reading state information... Done
7. The following additional packages will be installed:
libcap2-bin libpam-cap
8. The following NEW packages will be installed:
iputils-ping libcap2-bin libpam-cap
0 upgraded, 3 newly installed, 0 to remove andd 0 not upgraded.
9. Need to get 96.2 kB of archives.
10. After this operation, 311 kB of additional cdisk space will be used
11. Doyouwanttocontinue?[Y/n]y
12. Get:1 http://deb.debian.org/debian bookworm//main amd64 libcap2-bin amd64 1:2.66-4 [34.7kB]
13. Get:2 http://deb.debian.org/debian bookworm/main amd64 12. iputils-ping amd64 3:20221126-1 [47.1 kB
14. Get:3 http://deb.debian.org/debian bookworm/main amd64 libpam-cap amd64 1:2.66-4 [14.5 kB]
15. Fetched 96.2 kB in 5s (18.8 kB/s)
16. debconf: delaying package configuration, since apt-uttils is not installed
17. Selecting previously unselected package libcap2-bin.
(Reading database ... 7582 files and directories currently installed.)
18. Preparing to unpack .../libcap2-bin_1ខ3a2.66-4_amd64deb...
19. Unpacking libcap2-bin (1:2.66-4) ...
20. Selecting previously unselected package iputils-ping···
21. Preparing to unpack .../iputils-ping_3៛3a20221126-1_amd64.deb...
22. Unpacking iputils-ping (3:20221126-1)
23. Selecting previously unselected package libpam-cap:amd64.
24. Preparing to unpack .../libpam-cap_183a2.66-4_amd64.deb ...
25. Unpacking libpam-cap:amd64 (1:2.66-4)
26. Setting up libcap2-bin(1:2.66-4)···
27. Setting up libpam-cap:amd64 (1:2.66-4)
28. debconf: unable to initialize frontend: Dialog
29. debconf: (No usable dialog-like program is installed,,so the dialog based frontend cannot be used. at/usr/share/per15/Debconf/FrontEnd/Dialog.pm line 78.)
30. debconf: falling back to frontend: Readline
31. debconf: unable to initialize frontend: Readline
32. debconf: (Can't locate Term/ReadLine.pm in @INC (youmay need to install the Term::ReadLine module)((INC)contains:/etc/perl /usr/local/lib/x86_64-linux-gnu//per1/5.36.0 /usr/local/share/perl/5.36.0 /usr/lib/x86_64-linux-gnu/per15/5.36 /usr/share/per15 /usr/lib/xx8
6_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/peerl/5.36 /usr/share/perl/5.36 /usr/local/lib/site_percl) at /usr/share/per15/Debconf/FrontEnd/Readline.pmline 7.
33. debconf: falling back to frontend: Teletype
34. Setting up iputils-ping (3:20221126-1) ...

  1. 使用ping命令
ping www.baidu.com
root@pod2:/# ping www.baidu.com
PING www.a.shifen.com (220.181.38.150) 56(84) byte3 of data.
64 bytes from 220.181.38.150 (220.181.38.150): icmp_seq=1 ttl=48 time=4.92 ms
64 bytes from 220.181.38.150 (220.181.38.150): icmp_seq=2 ttl=48 time=27.7 ms
--- www.a.shifen.com ping statistics
2 packets transmitted, 2 received, 0% packetloss, time 1001ms
rtt min/avg/max/mdev = 4.922/16.316/27.711/111.394 ms

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值