[英]Docker: ping: unknown host yahoo.com
以下是我嘗試過的所有事情:
與-dns一起使用docker deamon:
sudo docker -d -dns 8.8.8.8
確保啟用了IP轉發:
$ sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1
名稱服務器到位:
$ docker -dns '8.8.8.8' run centos:6.4 ping -c 3 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 12000ms
感謝任何建議。
這聽起來像Docker的自動iptables配置不起作用。 如果您在不重新啟動Docker守護程序的情況下更改了主機IP地址,則通常會發生這種情況。 我會嘗試以下方法:
iptables --list --table nat
的輸出 我看起來如此:
# iptables --list --table nat
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DOCKER all -- anywhere anywhere ADDRTYPE match dst-type LOCAL
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
DOCKER all -- anywhere !127.0.0.0/8 ADDRTYPE match dst-type LOCAL
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- <redacted>/24 !<redacted>/24
MASQUERADE all -- <redacted>/16 !<redacted>/16
Chain DOCKER (2 references)
target prot opt source destination
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.