su -root

Docker的CentOS镜像由于做了精简,去掉了 ping 命令,那我们该如何安装这个命令呢

首先可以用 yum provides 命令来搜索哪个软件包里包含了 ping 命令

[root@a7128460b671 /]# yum provides "*/ping"

Loaded plugins: fastestmirror, ovl

Determining fastest mirrors

* base: mirrors.cn99.com

* extras: mirrors.cn99.com

* updates: mirrors.cn99.com

base                                                                                                                                                                  | 3.7 kB     00:00

base/primary_db                                                                                                                                                       | 4.7 MB     00:01

extras                                                                                                                                                                | 3.4 kB     00:00

extras/primary_db                                                                                                                                                     |  29 kB     00:00

updates                                                                                                                                                               | 3.4 kB     00:00

updates/primary_db                                                                                                                                                    | 5.3 MB     00:01

base/filelists_db                                                                                                                                                     | 6.4 MB     00:01

extras/filelists_db                                                                                                                                                   |  25 kB     00:00

updates/filelists_db                                                                                                                                                  | 3.2 MB     00:00

pacemaker-cli-1.1.15-5.el6.x86_64 : Command line tools for controlling Pacemaker clusters

Repo        : base

Matched from:

Filename    : /usr/lib/ocf/resource.d/pacemaker/ping

irssi-0.8.15-5.el6.x86_64 : Modular text mode IRC client with Perl scripting

Repo        : base

Matched from:

Filename    : /usr/share/irssi/help/ping

iputils-20071127-24.el6.x86_64 : Network monitoring tools including ping

Repo        : base

Matched from:

Filename    : /bin/ping

1:qt-examples-4.6.2-28.el6_5.x86_64 : Programming examples for qt

Repo        : base

Matched from:

Filename    : /usr/lib64/qt4/examples/dbus/pingpong/ping

可以看到好几个软件包都包含这个命令,但 iputils 最像是我们要找的,安装它

[root@a7128460b671 /]# yum install iputils

.......

[root@a7128460b671 /]# ping 114.114.114.114

PING 114.114.114.114 (114.114.114.114) 56(84) bytes of data.

64 bytes from 114.114.114.114: icmp_seq=1 ttl=65 time=8.28 ms

64 bytes from 114.114.114.114: icmp_seq=2 ttl=84 time=9.25 ms

64 bytes from 114.114.114.114: icmp_seq=3 ttl=63 time=7.69 ms

64 bytes from 114.114.114.114: icmp_seq=4 ttl=63 time=8.43 ms

64 bytes from 114.114.114.114: icmp_seq=5 ttl=63 time=10.2 ms

————————————————

版权声明:本文为CSDN博主「豆蔻词工难赋深情」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。

原文链接:https://blog.csdn.net/zhang197093/article/details/78732494

Logo

更多推荐