Platform & Service/Docker

Fails on iptables(No chain/target/match by that name)

Jared 2019. 6. 28. 10:33

Error:

docker: error response from daemon: driver failed programming external connectivity on endpoint
...
iptables failed: ~~~ ! -i docker0: iptables: No chain/target/match by that name

Root cause:

Docker creates the docker chain when it started, but the iptables changed by another process, for example, firewalld.

Check iptable: iptables -L

Solution:

1. Restart docker and the correct iptables rules will be created.

2. Add docker chain into iptables manually.

iptables -t nat -N DOCKER
iptables -t nat -A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
iptables -t nat -A PREROUTING -m addrtype --dst-type LOCAL ! --dst 127.0.0.0/8 -j DOCKER
service iptables save
service iptables restart
iptables -L
service docker restart