2013-11-25 117 views
3

這裏是所有我試過的東西:泊塢窗:平:未知的主機yahoo.com

跑了-dns碼頭工人守護進程:

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 

欣賞任何建議。

回答

0

聽起來像Docker的自動iptables配置不起作用。如果您在不重新啓動Docker守護程序的情況下更改主機IP地址,通常會發生這種情況。我會嘗試以下方法:

  1. 確保您可以從主機ping通(只是要確定!)
  2. 重新啓動泊塢窗守護程序,然後再試一次(這應該重置iptables配置)
  3. 從檢查輸出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