【Linux】 安装ping工具

【Linux】 安装ping工具

1、背景

最近在使用docker,通过镜像创建的容器里面,使用ping 命令报错:

root@c9fdfc1b40da:~# ping www.baidu.com
bash: ping: command not found

即在容器中没有ping工具。

2、安装命令

apt-get install inetutils-ping

示例如下:

root@c9fdfc1b40da:~# apt-get install inetutils-ping
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  netbase
The following NEW packages will be installed:
  inetutils-ping netbase
0 upgraded, 2 newly installed, 0 to remove and 11 not upgraded.
Need to get 72.6 kB of archives.
After this operation, 389 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 netbase all 5.4 [12.7 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 inetutils-ping amd64 2:1.9.4-3ubuntu0.1 [59.9 kB]
Fetched 72.6 kB in 1s (55.0 kB/s)         
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package netbase.
(Reading database ... 15445 files and directories currently installed.)
Preparing to unpack .../archives/netbase_5.4_all.deb ...
Unpacking netbase (5.4) ...
Selecting previously unselected package inetutils-ping.
Preparing to unpack .../inetutils-ping_2%3a1.9.4-3ubuntu0.1_amd64.deb ...
Unpacking inetutils-ping (2:1.9.4-3ubuntu0.1) ...
Setting up netbase (5.4) ...
Setting up inetutils-ping (2:1.9.4-3ubuntu0.1) ...
root@c9fdfc1b40da:~# ping www.baidu.com
PING www.a.shifen.com (180.101.49.12): 56 data bytes
64 bytes from 180.101.49.12: icmp_seq=0 ttl=50 time=13.000 ms
64 bytes from 180.101.49.12: icmp_seq=1 ttl=50 time=13.188 ms
64 bytes from 180.101.49.12: icmp_seq=2 ttl=50 time=10.175 ms
64 bytes from 180.101.49.12: icmp_seq=3 ttl=50 time=20.596 ms
64 bytes from 180.101.49.12: icmp_seq=4 ttl=50 time=9.954 ms
^C--- www.a.shifen.com ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/stddev = 9.954/13.383/20.596/3.854 ms
root@c9fdfc1b40da:~#
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

jn10010537

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值