太阳一出红似火,二八佳人把胭脂抹,越抹越红,越红越抹
在用脚本启动docker时出现了以下错误
Creating mongo ...
Creating elasticsearch ...
Creating elasticsearch ... error
WARNING: Host is already in use by another container
ERROR: for elasticsearch Cannot start service elasticsearch: driver failed programming external connectivity on endpoint elasticsearch (8718c32d476d708db616ea7be551c7df9eaca61afa558495e3f3a8980b22bde1): (iptables failed: iptables --waCreating mongo ... error
(exit status 1))
WARNING: Host is already in use by another container
ERROR: for mongo Cannot start service mongo: driver failed programming external connectivity on endpoint mongo (7c3cb8590571d75d7221270080c8080db1e6a11cc6ae375eb2413d2c3e372b5a): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 27017 -j DNAT --to-destination 172.26.0.3:27017 ! -i br-8bf121afba80: iptables: No chain/target/match by that name.
(exit status 1))
Creating rabbitmq ... error
ERROR: for rabbitmq Cannot start service rabbitmq: driver failed programming external connectivity on endpoint rabbitmq (287016470c9db2db0a2df7d8e55bb60a16472c350460ff38cf17aeb5a757f9c1): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 15672 -j DNAT --to-destination 172.26.0.4:15672 ! -i br-8bf121afba80: iptables: No chain/target/match by that name.
(exit status 1))
ERROR: for elasticsearch Cannot start service elasticsearch: driver failed programming external connectivity on endpoint elasticsearch (8718c32d476d708db616ea7be551c7df9eaca61afa558495e3f3a8980b22bde1): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 9300 -j DNAT --to-destination 172.26.0.2:9300 ! -i br-8bf121afba80: iptables: No chain/target/match by that name.
(exit status 1))
ERROR: for mongo Cannot start service mongo: driver failed programming external connectivity on endpoint mongo (7c3cb8590571d75d7221270080c8080db1e6a11cc6ae375eb2413d2c3e372b5a): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 27017 -j DNAT --to-destination 172.26.0.3:27017 ! -i br-8bf121afba80: iptables: No chain/target/match by that name.
(exit status 1))
ERROR: for rabbitmq Cannot start service rabbitmq: driver failed programming external connectivity on endpoint rabbitmq (287016470c9db2db0a2df7d8e55bb60a16472c350460ff38cf17aeb5a757f9c1): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 15672 -j DNAT --to-destination 172.26.0.4:15672 ! -i br-8bf121afba80: iptables: No chain/target/match by that name.
(exit status 1))
ERROR: Encountered errors while bringing up the project.
错误原因:
docker服务启动时定义的自定义链docker,由于centos7 firewall 被清掉
firewall的底层是使用iptables进行数据过滤,建立在iptables之上,这可能会与 Docker 产生冲突。
当 firewalld 启动或者重启的时候,将会从 iptables 中移除 docker的规则,从而影响了 Docker 的正常工作。
当你使用的是 systemd 的时候, firewalld 会在 Docker 之前启动,但是如果你在 Docker 启动之后再启动 或者重启 firewalld ,你就需要重启 Docker 进程了。
重启docker服务及可重新生成自定义链docker。
解决方法:
使用systemd关闭firewalld 之后要重启docker
重启docker服务后再启动容器
systemctl restart docker
网友评论