启动docker容器时报错:
root@dreamer7:/root # docker run -it -p 80:80 vulnerables/web-dvwa
docker: Error response from daemon: driver failed programming external connectivity on endpoint gifted_goldwasser (680172f14ce6eab20619aec805d71ce459c060292e5dbdffbfa2c1c3c4fa3353): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 80 -j DNAT --to-destination 172.17.0.3:80 ! -i docker0: iptables: No chain/target/match by that name.
(exit status 1)).
可能的原因:docker服务启动时定义的自定义链DOCKER由于某种原因被清掉,重启docker服务及可重新生成自定义链DOCKER
root@ubuntu:/root # iptables -t nat -nL
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DOCKER all -- 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type LOCAL
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
DOCKER all -- 0.0.0.0/0 !127.0.0.0/8 ADDRTYPE match dst-type LOCAL
解决办法
- 重启docker:
systemctl restart docker
- 重启容器:
docker start xxxxxxxxxxxx