docker - 无法 ping docker 主机,但世界是可达的
问题描述
我能够从运行 docker 容器的容器中 ping 世界其他地方,但不能 ping 主机。我确定有人以前遇到过这个问题
请参阅下面的详细信息
Ubuntu 14.04.2 LTS (GNU/Linux 3.16.0-30-generic x86_64
**Container is using "bridge" network
Docker version 18.06.1-ce, build e68fc7a**
IP address for eth0: 135.25.87.162
IP address for eth1: 192.168.122.55
IP address for eth2: 135.21.171.209
IP address for docker0: 172.17.42.1
route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 135.21.248.1 0.0.0.0 UG 0 0 0 eth1
135.21.171.192 * 255.255.255.192 U 0 0 0 eth2
135.21.248.0 * 255.255.255.0 U 0 0 0 eth1
135.25.87.128 * 255.255.255.192 U 0 0 0 eth0
172.17.0.0 * 255.255.0.0 U 0 0 0 docker0
192.168.122.0 * 255.255.255.192 U 0 0 0 eth1
#ping commands from container
# ping google.com
PING google.com (64.233.177.113): 56 data bytes
64 bytes from 64.233.177.113: icmp_seq=0 ttl=29 time=51.827 ms
64 bytes from 64.233.177.113: icmp_seq=1 ttl=29 time=50.184 ms
64 bytes from 64.233.177.113: icmp_seq=2 ttl=29 time=50.991 ms
^C--- google.com ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 50.184/51.001/51.827/0.671 ms
# ping 135.25.87.162
PING 135.25.87.162 (135.25.87.162): 56 data bytes
^C--- 135.25.87.162 ping statistics ---
4 packets transmitted, 0 packets received, 100% packet loss
root@9ed17e4c2ee3:/opt/app/tomcat#
解决方案
推荐阅读
- docker - 如何在 minikube 中创建多个集群
- iphone-privateapi - AppLaunchStats:PrivateFrameworks/AppLaunchStats.framework 可用于启动应用程序?
- regex - 正则表达式:提取由特定单词分隔的单词
- flutter - 如何使用不迁移到空安全的包进行构建?
- c# - MciSendString 别名重用
- .net - 更新到引导程序 5 MVC 后在 WebGrease.dll 中引发异常
- php - php ajax一次又一次地获取相同的文件html
- gradle - Gradle 7 迁移:无法应用 PublishPlugin(maven-publish):当项目已经评估时无法运行 afterEvaluate
- android - Flutter:android不允许应用在外部存储中创建新文件夹来保存文件?
- maven - Apache flink force-shading 依赖的源码