美文网首页
CentOS7下指定Docker端口报错

CentOS7下指定Docker端口报错

作者: touch_The_Sky | 来源:发表于2018-09-25 13:30 被阅读0次

错误:

# docker run -d -p 99:9999  training/webapp python app.py
1325dce379ac8b1c0c8bee610496493aaeaf5f07bd66b570d825dfa654ea265c
/usr/bin/docker-current: Error response from daemon: driver failed programming external 
connectivity on endpoint affectionate_jones (d7f626f6db732089550b3724705f91fdb5545d34917d3d62bc1745093a4d48a0): 
 (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 99 -j DNAT --to-
destination 172.18.0.3:9999 ! -i docker0: iptables: No chain/target/match by that name.

错误原因:

解决方法:
pkill docker 终止进程
iptables -t nat -F 清空nat表的所有链
ifconfig docker0 down#停止docker默认网桥
docker -d (后台运行docker)
systmctl restart docker(重启docker)
重新执行:成功!

#docker run -d -p 80:9999  training/webapp python app.py
4daea226e5ac47694924c3a5734b37407e23b61de0206d7c9cfa6db2768c146b
# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                            NAMES
4daea226e5ac        training/webapp     "python app.py"     7 minutes ago       Up 7 minutes        5000/tcp, 0.0.0.0:80->9999/tcp   vibrant_keller

相关文章

网友评论

      本文标题:CentOS7下指定Docker端口报错

      本文链接:https://www.haomeiwen.com/subject/bjddjftx.html