啟動容器時報錯:iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 1217 -j DNAT --to-de

2020-09-23 12:01:06

故障原因:

利用tomct映象啟動容器時報錯:

[root@localhost Tomcat]# docker run -d --name tomcat2 -p 1217:8080 tomcat:centos
0556dfeca0ba77452a7d93546cf65b8b96d3e294916dab798438caedd1efb8dc
docker: Error response from daemon: driver failed programming external connectivity on endpoint tomcat2 (a1948113741590843b4c4439833f6fcfd555bc71c9fab97d51e4b55d2e4e60ab):  (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 1217 -j DNAT --to-destination 172.17.0.5:8080 ! -i docker0: iptables: No chain/target/match by that name.
 (exit status 1)).

解決方法:

1.重新啟動docker服務

[root@localhost Tomcat]# systemctl restart docker.service

2.刪掉不完整容器,利用該映象重新啟動一個容器

[root@localhost Tomcat]# docker run -d --name tomcat2 -p 1217:8080 tomcat:centos