docker容器iptables failed: iptables --wait -t nat -A DOCKER&n

今天tomcat的docker容器挂了,只要是带命令-p映射端口就起不来并且报错:

Error response from daemon: Cannot start container eb9d501f56bc142d9bf75ddfc7ad88383b7388ca6a5959309af2165f1fff6292: iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 8081 -j DNAT --to-destination 

172.17.0.164:8080 ! -i docker0: iptables: No chain/target/match by that name.

 (exit status 1)

 

网上查找发现,可能是网络问题造成

首先先验证docker容器内部网络是否能ping通宿主机

如果能ping通,即可通过重建docker0网络恢复

先停掉宿主机上运行的docker容器,然后执行以下命令

在宿主机执行:

  1. pkill docker 
  2. iptables -t nat -F 
  3. ifconfig docker0 down 
  4. brctl delbr docker0 
  5. docker -d 
  6. systemctl restart docker重启docker服务

问题即可解决。。

你可能感兴趣的:(docker容器iptables failed: iptables --wait -t nat -A DOCKER&n)