Problem restoration:
The following error occurs when starting docker and mapping to the host:
/usr/bin/docker-current: Error response from daemon: driver failed programming external connectivity on endpoint sc_mysql (1bc03030afe9f722ae1e6b46166172a70cf87bcc3f02f0acdac0be2a7f0f0036): (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.
Cause analysis:
This is The external connection failed due to an error response from the daemon.
Solution:
First kill the docker process, then clear all the chains (rules) under the nat table under iptables, and finally delete the docker bridge and restart Docker service is enough.
The specific steps are as follows:
[root@seichung ] pkill docker # 终止进程 [root@seichung ] iptables -t nat -F # 清空 nat 表的所有链 [root@seichung ] ifconfig docker0 down # 停止 docker 默认网桥 [root@seichung ] yum install bridge-utils -y # 部分机器是无法使用 brctl,所以需要提前安装 [root@seichung ] brctl delbr docker0 # 删除网桥 [root@seichung ] systemctl restart docker # 重启docker
After the docker image is successfully mapped, the corresponding chain will be added to iptables, as shown in the figure:
Recommended tutorial: docker tutorial
The above is the detailed content of What should I do if an error occurs when starting docker to map to the host?. For more information, please follow other related articles on the PHP Chinese website!