启动docker时映射到宿主机时出现/usr/bin/docker-current: Error response from daemon: driver failed...的解决方案

/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.

[root@joker ~] pkill docker                         #终止进程
[root@joker ~] iptables -t nat -F                    #清空nat表的所有链
[root@joker ~] ifconfig docker0 down                 #停止docker默认网桥
[root@joker ~] yum install bridge-utils -y  # 部分机器是无法使用brctl,所以需要提前安装
[root@joker ~] brctl delbr docker0                  #删除网桥  
[root@joker ~] systemctl restart docker             #重启docker

docker镜像成功映射后,会在 iptables 上添加所属的链

你可能感兴趣的:(启动docker时映射到宿主机时出现/usr/bin/docker-current: Error response from daemon: driver failed...的解决方案)