2013-11-25 75 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