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:没有该名称的链/目标/匹配。

错误原因:

在设置linux服务器的防火墙时,重启后,原有的docker端口映射被清空,可以通过命令iptables -L可以查看iptables链,如果是空的或者上面报错的映射端口不存在,则需要重启docker服务。

解决方法:

命令:

sudo systemctl restart docker

然后将每个容器重启即可,无需删除容器,无需重装docker。

上一篇:计算机网络实验八:网络地址转换之动态NAT


下一篇:SkyWalking