Home > Operation and Maintenance > Docker > What should I do if an error occurs when starting docker to map to the host?

What should I do if an error occurs when starting docker to map to the host?

王林
Release: 2020-05-21 15:10:25
Original
2870 people have browsed it

What should I do if an error occurs when starting docker to map to the host?

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.
Copy after login

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
Copy after login

After the docker image is successfully mapped, the corresponding chain will be added to iptables, as shown in the figure:

What should I do if an error occurs when starting docker to map to the host?

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template