[Solved] docker: Error response from daemon: driver failed programming external connectivity on endpoint mysql-test …

1. The problem is as follows

[root@echohye app]# docker run -itd --name mysql-test -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7
5ae9dc1c7bf16762e7064a5f3ab0396b1f5ba3a23e64997939730f27aa11eebb
docker: Error response from daemon: driver failed programming external connectivity on endpoint mysql-test (b428e451446b6b6bd1be1ea58ca6f66b632680b0756d6fe9c9411099c03dff5b):  (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 3306 -j DNAT --to-destination 172.17.0.2:3306 ! -i docker0: iptables: No chain/target/match by that name.

2. Solution

After consulting the information, it is known that it is the cause of the docker0 bridge. To solve the above error problem, the following steps are required.

1. Kill all docker processes

pkill docker 

2. Clear all chains of the nat table

iptables -t nat -F

3. Stop docker default bridge docker0

ifconfig docker0 down

4. Delete the docker0 bridge

brctl delbr docker0

5. Restart the docker service

systemctl restart docker

6. Rerun the original command

[root@echohye /]# docker run -itd --name mysql-test -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7
7097016ef0b1c57b6db110dff96b179f8989427c55b1501c36c1c1fb425ba5ce

[root@echohye /]# docker ps
CONTAINER ID   IMAGE       COMMAND                  CREATED         STATUS         PORTS       NAMES
7097016ef0b1   mysql:5.7   "docker-entrypoint.s…"   4 minutes ago   Up 4 minutes   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp   mysql-test

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *