几分钟后Ubuntu 14.04中断了Docker网络

时间:2019-03-15 22:10:08

标签: docker ubuntu-14.04

我在使用Ubuntu 14.04的服务器上创建docker网络,在该网络中运行2个容器(集线器和节点),并尝试按容器名称从hod ping集线器。它可以工作几秒钟或几分钟,但经过一段时间后失去连接。

网络和容器:

docker network create grid
docker run -d --rm --net grid --name selenium-hub hub:v0.1
docker run -d --rm --net grid  -it node:v0.1 bash

Ping:

root@54385bbb4922:/# ping selenium-hub
PING selenium-hub (172.24.0.2) 56(84) bytes of data.
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=1 ttl=64 time=0.088 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=2 ttl=64 time=0.046 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=3 ttl=64 time=0.045 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=4 ttl=64 time=0.060 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=5 ttl=64 time=0.043 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=6 ttl=64 time=0.048 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=7 ttl=64 time=0.046 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=8 ttl=64 time=0.040 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=9 ttl=64 time=0.047 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=10 ttl=64 time=0.042 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=11 ttl=64 time=0.047 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=12 ttl=64 time=0.049 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=13 ttl=64 time=0.048 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=14 ttl=64 time=0.045 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=15 ttl=64 time=0.068 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=16 ttl=64 time=0.065 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=17 ttl=64 time=0.059 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=18 ttl=64 time=0.055 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=19 ttl=64 time=0.056 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=20 ttl=64 time=0.062 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=21 ttl=64 time=0.048 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=22 ttl=64 time=0.043 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=23 ttl=64 time=0.056 ms
64 bytes from selenium-hub.grid (172.24.0.2): icmp_seq=24 ttl=64 time=0.054 ms
^C
--- selenium-hub ping statistics ---
54 packets transmitted, 24 received, 55% packet loss, time 52999ms
rtt min/avg/max/mdev = 0.040/0.052/0.088/0.012 ms

失去连接后,docker仍将容器名称解析为ip

root@2313d40e2018:/# ping selenium-hub
PING selenium-hub (172.17.0.2) 56(84) bytes of data.
^C
--- selenium-hub ping statistics ---
2458 packets transmitted, 0 received, 100% packet loss, time 2476656ms

这种情况在我每次删除并重新创建网络时都会令人沮丧。

同时在使用Ubuntu 16.04的本地系统上,一切正常。

我找到了这个答案https://askubuntu.com/a/708487,但是:
1)据我了解,服务器上没有NetworkManager

    ~$ ps ax | grep anager
  120 ?        S<     0:00 [charger_manager]
19798 pts/5    S+     0:00 grep --color=auto anager

2)将iface docker0 inet manual添加到/etc/network/interfaces不会改变

还有什么可以自动破坏/重新配置docker网络?

Docker版本18.06.3-ce,内部版本d7080c1

0 个答案:

没有答案