docker报错:driver failed programming external connectivity on endpoint, iptables:No chain by that name
docker 報錯:
Error response from daemon: Cannot restart container hello: driver failed programming external connectivity on endpoint hello (e58d18c830689e296c0fafdd98bf56e973cee3a3fbee8a3f002d46784f69ae70): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 6081 -j DNAT --to-destination 172.0.0.2:8080 ! -i docker0: iptables: No chain/target/match by that name.
(exit status 1))
翻譯:無法重新啟動容器hello:驅動程序未能在端點hello上編程外部連接:(iptables失敗:iptables–wait–t nat–A DOCKER–p tcp–d 0/0–dport 6081–j DNAT–to destination 172.18.0.2:8080!-i docker0:iptables:沒有該名稱的鏈/目標/匹配。
錯誤原因:
docker 服務啟動的時候,docker服務會向iptables注冊一個鏈,以便讓docker服務管理的containner所暴露的端口之間進行通信。
如果你刪除了iptables中的docker鏈,或者iptables的規則被丟失了(例如重啟firewalld),原有的docker端口映射不存在了。
可以通過命令iptables -L可以查看iptables鏈,如果是空的或者上面報錯的映射端口不存在,那你的問題應該是這個原因了。
解決方法:
命令:
sudo systemctl restart docker
然后將每個容器重啟即可,無需刪除容器,無需重裝docker。
總結
以上是生活随笔為你收集整理的docker报错:driver failed programming external connectivity on endpoint, iptables:No chain by that name的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 数据库中自定义排序规则,Mysql中自定
- 下一篇: 系统架构升级要不要上微服务?历“久”弥新