docker启动时报错Error response from daemon: driver failed programming external connectivity on endpoint *

公司服务器由于断电重启,部署在docker服务上的一些web服务需要重新开启容器,

[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d77c2c6b3650 chandao:latest "/app/docker-entrypo…" days ago Up About an hour 0.0.0.0:->/tcp chandao

当重新开启容器的时候,web服务页面无法访问

[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
18807008623c centos:latest "/bin/bash" days ago Exited () About an hour ago heuristic_aryabhata
d77c2c6b3650 chandao:latest "/app/docker-entrypo…" days ago Up About an hour 0.0.0.0: ->/tcp chandao
12d299f61e0b djltomcat:latest "/root/run.sh" weeks ago Exited () About an hour ago 0.0.0.0: ->/tcp kjxy
[root@localhost ~]# docker start kjxy
kjxy
[root@localhost ~]#
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d77c2c6b3650 chandao:latest "/app/docker-entrypo…" days ago Up About an hour 0.0.0.0:->/tcp chandao
12d299f61e0b djltomcat:latest "/root/run.sh" weeks ago Up seconds 0.0.0.0:->/tcp kjxy
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]#
[root@localhost ~]# systemctl is-active firewalld
inactive

于是重新启动了一下容器,报如下错误

[root@localhost ~]# docker stop kjxy
kjxy
[root@localhost ~]#
[root@localhost ~]# docker start kjxy
Error response from daemon: driver failed programming external connectivity on endpoint kjxy (d347e043e31906b2bcb2733437cc52fd96fc653c3fcca18b664f65940da9db79): (ip tables failed: iptables --wait -t nat -A DOCKER -p tcp -d / --dport -j DNAT --to-destination 172.17.0.6: ! -i docker0: iptables: No chain/target/match by that name.
(exit status ))
Error: failed to start containers: kjxy
[root@localhost ~]#

查看容器详细信息

[root@localhost ~]# docker inspect kjxy
[
{
"Id": "12d299f61e0bccd29d35bffe5e98ff6abba934673c457e50246d1a857ebe4374",
"Created": "2019-03-05T05:22:35.219042191Z",
"Path": "/root/run.sh",
"Args": [],
"State": {
"Status": "exited",
"Running": false,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": ,
"ExitCode": ,
"Error": "driver failed programming external connectivity on endpoint kjxy (6206f4102fb1f8a007b2306fc9b9caa3e87abd8e00d4a26a78b72e2242292970): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 7074 -j DNAT --to-destination 172.17.0.6:8080 ! -i docker0: iptables: No chain/target/match by that nam e.\n (exit status 1))",
"StartedAt": "2019-03-20T00:45:14.267504968Z",
"FinishedAt": "2019-03-20T01:26:36.1111497Z"
},

在网上找了一篇文章

原文链接

https://www.cnblogs.com/hailun1987/p/7518306.html

http://blog.sina.com.cn/s/blog_8ea8e9d50102wwf8.html

https://blog.csdn.net/czz1141979570/article/details/78752671

原因:

docker服务启动时定义的自定义链DOCKER由于某种原因被清掉
重启docker服务及可重新生成自定义链DOCKER

解决办法:

重启docker服务后再启动容器
systemctl restart docker

问题解决

end

上一篇:java(搜索不区分大小写)


下一篇:mysql各种引擎对比、实战