docker安装ping
apt-get update
apt install iputils-ping
查询docker宿主机IP
宿主机使用ifconfig
docker0 就是宿主机IP,容器内部可以使用该IP访问宿主机
root@feifei-PC:/home/feifei# ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:a2:f3:15:d5 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp5s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.30.2 netmask 255.255.255.0 broadcast 192.168.30.255
inet6 fe80::1583:7d93:a66e:22ad prefixlen 64 scopeid 0x20<link>
ether 18:c0:4d:40:2d:c0 txqueuelen 1000 (Ethernet)
RX packets 14278 bytes 14645530 (13.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 11244 bytes 1772447 (1.6 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 57 bytes 5513 (5.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 57 bytes 5513 (5.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
查看容器IP
docker inspect 容器名/id
#ping
apt install inetutils-ping
#nslookup
apt install dnsutils
#ifconfig
apt install net-tools
#ip
apt install iproute2
#curl
apt install curl