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。

相关文章

Docker是什么Docker是 Docker.Inc 公司开源的一个基于 LXC技...
本文为原创,原始地址为:http://www.cnblogs.com/fengzheng...
镜像操作列出镜像:$ sudo docker imagesREPOSITORY TAG IMA...
本文原创,原文地址为:http://www.cnblogs.com/fengzheng/p...
在 Docker 中,如果你修改了一个容器的内容并希望将这些更改...
在Docker中,--privileged 参数给予容器内的进程几乎相同的权...