Docker容器无法连接到互联网。但是可以ping任何外部IP

时间:2019-09-24 06:55:03

标签: docker dns docker-compose

无法从docker容器ping或连接到任何互联网域 Manjaro Linux

在主机/etc/docker/daemon.json中设置的

dns

/etc/resolv.conf在docker容器中:

root@785625d57ad5:/# cat /etc/resolv.conf 
nameserver 8.8.4.4
nameserver 8.8.8.8

ping来自docker contaner(ip为google.com)

root@785625d57ad5:/# ping -c 3 172.217.23.142
PING 172.217.23.142 (172.217.23.142) 56(84) bytes of data.
64 bytes from 172.217.23.142: icmp_seq=2 ttl=53 time=51.9 ms
64 bytes from 172.217.23.142: icmp_seq=3 ttl=53 time=51.9 ms

--- 172.217.23.142 ping statistics ---
3 packets transmitted, 2 received, 33% packet loss, time 2018ms
rtt min/avg/max/mdev = 51.973/51.980/51.987/0.007 ms
root@785625d57ad5:/# ping -c 3 google.com
ping: unknown host google.com

0 个答案:

没有答案