Docker常见问题1: driver failed programming external connectivity on endpoint

问题

docker-compose up -d 启动服务时出现以下错误

ERROR: for product-1.0  Cannot start service product-1.0: driver failed programming external connectivity on endpoint product-1.0 (e48bf41b4103d1876e41755abd2a3d35474f206b78ec60dadb824a2093c615a8):  (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 8107 -j DNAT --to-destination xxxx:8087 ! -i br-66f24db55be3: iptables: No chain/target/match by that name.

原因

经过确认,由于服务器最近存在防火墙的重启。
防火墙使用 iptables 进行数据过滤,建立在iptables之上,这可能会与docker产生冲突。当 防火墙 启动或者关闭的时候,将会从 iptables 中移除 docker的相关规则,从而无法正常使用Docker。

方案

1、重启docker,重启前考虑目前正在运行的服务启动命令中是否存在–restart=always, 若不存在,且比较重要的服务,重启docker会需要自行重启服务。

systemctl restart docker

2、检查相关服务是否已经正常开启。

猜你喜欢

转载自blog.csdn.net/m0_37996629/article/details/128102011