我的机器和/或码头工具发生了什么事。我已经清除了docker并重新安装但是当我使用与docker0(或任何网络)关联的默认网络启动容器时,流量未正确路由。
在工作机器中的ip路由会显示类似
的内容172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1
但这在我当前的机器中不存在。如果我尝试ping容器,我什么也得不到,但是如果我添加路径
可以访问容器sudo ip route add 172.17.0.0/16 via 172.17.0.1
从docker0界面采购时,我甚至无法ping容器。使用我的默认网关路由流量。
相关的码头工人检查
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02"
ping不通
ping -I docker0 172.17.0.2
PING 172.17.0.2 (172.17.0.2) from 172.17.0.1 docker0: 56(84) bytes of data.
^C
--- 172.17.0.2 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1020ms
路线表
$ ip route
default via 192.168.1.1 dev wlp6s0 proto static metric 600
192.168.1.0/24 dev wlp6s0 proto none scope link metric 600 notify
192.168.250.0/24 dev anbox0 proto none scope link notify
接口
$ ip addr show docker0
75: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:76:23:4d:88 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 scope global docker0
valid_lft forever preferred_lft forever
添加路线
$ sudo ip route add 172.17.0.0/16 via 172.17.0.1
Ping工作
$ ping 172.17.0.2
PING 172.17.0.2 (172.17.0.2) 56(84) bytes of data.
64 bytes from 172.17.0.2: icmp_seq=1 ttl=64 time=0.090 ms