Fixed: «docker0: iptables: No chain/target/match by that name»

When i tried to launch a container, docker gave me this error

1 docker: Error response from daemon: failed to create endpoint registry on network bridge: iptables failed: iptables wait t nat A DOCKER p tcp d 0/0 dport 5050 j DNAT todestination 172.17.0.2:5000 ! i docker0: iptables: No chain/target/match by that name.

Reason : iptables rules which were inserted during docker restart were removed while i restarted iptables.

Fix : You can fix this by restarting docker service, it will insert the required rules to iptables .

On Centos7

Restart docker service

1   systemctl restart docker.service

Install iptables-services

1 yum install iptablesservices

And then enable the service using systemd:

1   systemctl enable iptables.service

Now you can save the rules

1   /usr/libexec/iptables/iptables.init save

 

 

On Centos6 ,

Restart docker using

1 service  docker restart

Now save iptables rules using command

1 iptablessave

Author: , 0000-00-00