docker启动报错

发布于 2020-03-30  700 次阅读


报错问题(iptables):

# docker-compose up -d     
Starting compose-mysql ... 
Starting compose-php   ... 
Starting compose-php   ... error

ERROR: for compose-php  Cannot start service php: driver failed programming external connectivity on endpoint compose-php (c2f649f235f1c75058939e7b5c2039abe119170c5af16015d2f865c908346943):  (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 9000 -j DNAT --to-destination 10.10.0.2:9000 ! -i br-73a0d6f7fa10: iptables: No chain/target/match by that name.
Starting compose-mysql ... error
WARNING: Host is already in use by another container

ERROR: for compose-mysql  Cannot start service mysql: driver failed programming external connectivity on endpoint compose-mysql (7ef9bd63539c84652fad1e0c505ae908ded45b9be87bae9175f676dd36645749):  (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 3306 -j DNAT --to-destination 10.10.10.1:3306 ! -i br-73a0d6f7fa10: iptables: No chain/target/match by that name.
 (exit status 1))

ERROR: for php  Cannot start service php: driver failed programming external connectivity on endpoint compose-php (c2f649f235f1c75058939e7b5c2039abe119170c5af16015d2f865c908346943):  (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 9000 -j DNAT --to-destination 10.10.0.2:9000 ! -i br-73a0d6f7fa10: iptables: No chain/target/match by that name.
 (exit status 1))

ERROR: for mysql  Cannot start service mysql: driver failed programming external connectivity on endpoint compose-mysql (7ef9bd63539c84652fad1e0c505ae908ded45b9be87bae9175f676dd36645749):  (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 3306 -j DNAT --to-destination 10.10.10.1:3306 ! -i br-73a0d6f7fa10: iptables: No chain/target/match by that name.
 (exit status 1))
ERROR: Encountered errors while bringing up the project.

 

环境:

重新启动了iptables,然后虽然docker进程还在,但是访问出问题(如果是开始了cdn的话,基本的内容还是可以访问的,但是如果涉及源文件,或者是请求后台的话,就会有问题),然后重启docker的时候报错如上图

 

分析报错,百度:

如果直接是复制一整段的内容,是无法精准的搜索出我们需要的内容的,如

for compose-php Cannot start service php: driver failed programming external connectivity on endpoint compose-php (c2f649f235f1c75058939e7b5c2039abe119170c5af16015d2f865c908346943): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 9000 -j DNAT --to-destination 10.10.0.2:9000 ! -i br-73a0d6f7fa10: iptables: No chain/target/match by that name. Starting compose-mysql

 


也有正确的答案,但是有点杂,无法精准,或者搜出的都是自己想要的,有更多的解决办法,也方便自己分析是什么问题


按照我总结的经验:

你可以不懂它的所有意思,但是你要认真的看报错,你要看出哪些是你懂的,然后再分步分析

for compose-php Cannot start service php: driver failed programming external connectivity on endpoint 
compose-php (c2f649f235f1c75058939e7b5c2039abe119170c5af16015d2f865c908346943): 
(iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 9000 -j DNAT --to-destination 
10.10.0.2:9000 ! -i br-73a0d6f7fa10: iptables: No chain/target/match by that name. Starting compose-mysql


这段报错中,很多英文也许你都不懂,但是我们会懂

iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 9000 -j DNAT --to-destination 10.10.0.2:9000 ! -i br-73a0d6f7fa10

解决:

直接百度:iptables: No chain/target/match by that name.