前提・実現したいこと
Dockerのバージョンを18.x(正確なバージョンは失念)系から19.03.13へアップグレードしたところ、
コンテナから外部向けに通信できなくなりました。
この状況を解消したいです。
状態
pingの状況
以下の通り、ホスト名・IPアドレスのどちらの指定でもpingで疎通できない状態です。
$ docker run -it --rm debian ping -c 1 google.com ping: google.com: Temporary failure in name resolution $ docker run -it --rm debian ping -c 1 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. --- 8.8.8.8 ping statistics --- 1 packets transmitted, 0 received, 100% packet loss, time 0ms
なお、ホストOS上ではどちらも疎通できている旨確認済みです。
ネットワーク周りの設定
ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether f6:08:0d:fa:10:b4 brd ff:ff:ff:ff:ff:ff 3: sit0: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default link/sit 0.0.0.0 brd 0.0.0.0 4: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000 link/ether 34:c3:d2:93:cd:23 brd ff:ff:ff:ff:ff:ff 5: p2p0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000 link/ether 36:c3:d2:93:cd:23 brd ff:ff:ff:ff:ff:ff 6: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default link/ether 02:42:5b:4a:1b:70 brd ff:ff:ff:ff:ff:ff
iptables -L
Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy DROP) target prot opt source destination DOCKER-USER all -- anywhere anywhere DOCKER-ISOLATION-STAGE-1 all -- anywhere anywhere ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED DOCKER all -- anywhere anywhere ACCEPT all -- anywhere anywhere ACCEPT all -- anywhere anywhere Chain OUTPUT (policy ACCEPT) target prot opt source destination Chain DOCKER (1 references) target prot opt source destination Chain DOCKER-ISOLATION-STAGE-1 (1 references) target prot opt source destination DOCKER-ISOLATION-STAGE-2 all -- anywhere anywhere RETURN all -- anywhere anywhere Chain DOCKER-ISOLATION-STAGE-2 (1 references) target prot opt source destination DROP all -- anywhere anywhere RETURN all -- anywhere anywhere Chain DOCKER-USER (1 references) target prot opt source destination RETURN all -- anywhere anywhere
iptables -L -t nat
Chain PREROUTING (policy ACCEPT) target prot opt source destination DOCKER all -- anywhere anywhere ADDRTYPE match dst-type LOCAL Chain INPUT (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination DOCKER all -- anywhere !loopback/8 ADDRTYPE match dst-type LOCAL Chain POSTROUTING (policy ACCEPT) target prot opt source destination MASQUERADE all -- 172.17.0.0/16 anywhere Chain DOCKER (2 references) target prot opt source destination RETURN all -- anywhere anywhere
sysctl net.ipv4.ip_forward(2020/10/28 19:42追記)
net.ipv4.ip_forward = 1
firewalld について(2020/10/28 19:42追記)
firewalldは未使用です。
docker network inspect bridge(2020/11/05 21:16追記)
[ { "Name": "bridge", "Id": "168c88ff61f7714631933374a51b27a0a17315613034eb352cfb4ae6b6565904", "Created": "2020-11-05T21:11:47.467361496+09:00", "Scope": "local", "Driver": "bridge", "EnableIPv6": false, "IPAM": { "Driver": "default", "Options": null, "Config": [ { "Subnet": "172.17.0.0/16", "Gateway": "172.17.0.1" } ] }, "Internal": false, "Attachable": false, "Ingress": false, "ConfigFrom": { "Network": "" }, "ConfigOnly": false, "Containers": {}, "Options": { "com.docker.network.bridge.default_bridge": "true", "com.docker.network.bridge.enable_icc": "true", "com.docker.network.bridge.enable_ip_masquerade": "true", "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0", "com.docker.network.bridge.name": "docker0", "com.docker.network.driver.mtu": "1500" }, "Labels": {} } ]
docker network ls(2020/11/05 21:16追記)
NETWORK ID NAME DRIVER SCOPE 168c88ff61f7 bridge bridge local dbd4737f60a2 host host local 8f72254d2392 none null local
docker run -it --rm debian ip a(2020/11/05 22:11追記)
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 2: sit0: <NOARP> mtu 1480 qdisc noop state DOWN group default link/sit 0.0.0.0 brd 0.0.0.0 9: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff inet 172.17.0.2/16 brd 172.17.255.255 scope global eth0 valid_lft forever preferred_lft forever
試したこと
ホストOSの再起動
reboot
Dockerサービスの再起動
service docker restart
Dockerサービスを停止した上でDokcerのブリッジ関連の設定を削除し、Dockerサービスを改めて起動
service docker stop iptables -t nat -F ifconfig docker0 down brctl delbr docker0 service docker start
補足情報(FW/ツールのバージョンなど)
稼働環境
アーキテクチャ:ARM v8(Pine64)
ホストOS:ARMBIAN 5.60 stable Debian GNU/Linux 9 (stretch)
インストールしたDockerのパッケージ名:Docker-ce
インストールに使ったsources.listの内容:
deb [arch=arm64] https://download.docker.com/linux/debian stretch stable
※今回のDockerのアップグレード時に、jessieからstretch に変更
(OS自体はDockerアップグレード前からstretchを使っており、今回の事象発生前後で変更なし)