安装Docker的时候没有启用firewalld,安装后启用了firewalld,结果发现启动容器的时候出现如下报错:
Error response from daemon: driver failed programming external connectivity on endpoint ccaa (e317c3369b10f83e2340d5ccb9450e8099cd5d9427ad1deea2a31021cdbd1dd5): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 51413 -j DNAT --to-destination 172.17.0.2:51413 ! -i docker0: iptables: No chain/target/match by that name.
(exit status 1))
原因是某种原因导致端口映射规则被清理掉了,解决办法是重启docker,然后会重新生成映射规则。
systemctl restart docker
重启docker后再启动容器:docker start xxx