docker - Ubuntu 14.04 几分钟后破坏了 docker 网络
问题描述
我使用 Ubuntu 14.04 在服务器上创建 docker 网络,在该网络(集线器和节点)中运行 2 个容器,并尝试通过容器名称从 hode 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
平:
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
解决方案
推荐阅读
- python-3.x - 代码拉起一个没有类型pyglet的对象
- css - 如何在 Angular 中更改 kendo-ui 对话框的背景颜色
- nginx - 第一次重载后:“nginx: [error] open() "/var/run/nginx.pid" failed (2: No such file or directory)”
- c++ - 将 Rust 项目链接到链接到其他 cmake 项目的 cmake 项目
- android - 百度地图发布构建崩溃:NoSuchMethodError: no static method "Lvi/com/gdi/bgl/android/java/EnvDrawText; 以下示例百度地图应用
- jquery - Jquery Sortable Bug:初始化后每次第一次拖动的项目的顶部+左偏移错误
- go - 找到并替换了 Go 模块,但不是必需的
- kubernetes - 具有metrics.enabled true的Bitnami memcached在使用terraform的kubernetes上失败
- python - BeautifulSoup 两次打印相同的结果
- python - 是否可以编写一个 python 脚本来创建一个新的 spyder 控制台?