运行容器时出现以下报错:
docker: Error response from daemon: driver failed programming external connectivity on endpoint elegant_ptolemy (7fe85ca6bd744449ff82b81c1577d73b6821c4e51780c8238fad6aa0cb940522): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 8004 -j DNAT --to-destination 172.17.0.2:80 ! -i docker0: iptables: No chain/target/match by that name.
(exit status 1)).
原因是:docker服务启动时定义的自定义链docker由于某种原因被清掉
重启docker服务及可重新生成自定义链DOCKER
docker:来自守护进程的错误响应:驱动程序在端点elegant_ptolemy (7fe85ca6d744449ff82b81c1577d73b6821c4e51780c8238fad6aa0cb940522)上的外部连接编程失败(iptables失败:iptables——等待-t nat -p tcp -d 0/0——dport 8004 -j DNAT——to-destination 172.17.0.2:80) !- docker0: iptables:没有链/目标/匹配的名称。
(退出状态1))。
[root@docker ~]# systemctl restart docker
[root@docker ~]# docker run -it -p 8004:80 nginx:latest /bin/bash
root@92ce7cee184c:/#
root@92ce7cee184c:/#
root@92ce7cee184c:/#