在一個arm開發板上安裝docker出現網路問題,bridge網路不通,使用host模式無問題,具體表現為:
1、主機可以ping通網關172.17.0.1,但是ping不同容器,如:172.17.0.2
2、容器間可以ping通,但是無法ping通網關172.17.0.1
3、ip轉發已開,cat /proc/sys/net/ipv4/ip_forward 顯示的是1
4、使用bridge模式和埠映射,如-p 80:80,
telnet 172.17.0.2 80 顯示
telnet: Unable to connect to remote host: No route to host
telnet 127.0.0.1 80
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Connection closed by foreign host.
請教各位大神看看可能是什么原因呢?
uj5u.com熱心網友回復:
iptablesroot@bpi:~# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy DROP)
target prot opt source destination
DOCKER-USER all -- 0.0.0.0/0 0.0.0.0/0
DOCKER-ISOLATION-STAGE-1 all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
DOCKER all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain DOCKER (1 references)
target prot opt source destination
ACCEPT tcp -- 0.0.0.0/0 172.17.0.2 tcp dpt:80
Chain DOCKER-ISOLATION-STAGE-1 (1 references)
target prot opt source destination
DOCKER-ISOLATION-STAGE-2 all -- 0.0.0.0/0 0.0.0.0/0
RETURN all -- 0.0.0.0/0 0.0.0.0/0
Chain DOCKER-ISOLATION-STAGE-2 (1 references)
target prot opt source destination
DROP all -- 0.0.0.0/0 0.0.0.0/0
RETURN all -- 0.0.0.0/0 0.0.0.0/0
Chain DOCKER-USER (1 references)
target prot opt source destination
RETURN all -- 0.0.0.0/0 0.0.0.0/0
uj5u.com熱心網友回復:
關閉防火墻和selinux。docker如果不指定--network的話,會默認指定到docker0上。所以創建出來的容器應該在同一網段。
https://blog.csdn.net/heian_99/article/details/104914945
你可以參考一下這個。
uj5u.com熱心網友回復:
可能是路由問題,宿主機上route -n,截個圖看下轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/14123.html
標籤:Docker
