docker 端口映射错误解决方法

COMMAND_FAILED: '/sbin/iptables -t nat -A DOCKER -p tcp -d 0/0 --dport 8111 -j DNAT --to-destination 172.17.0.6:8111 ! -i docker0' failed: iptables: No chain/target/match by that name.


pkill docker

iptables -t nat -F
ifconfig docker0 down

brctl delbr docker0

重启docker后解决

参考文章

http://www.linuxidc.com/Linux/2015-02/113141.htm

[root@centos4 ~]# docker run -itd -p :8080  --name=django eb4
f270ba90282a36493ce3f7226adc65222d10a643beb3bb07e28d4ae22911ba6c
/usr/bin/docker-current: Error response from daemon: driver failed programming external co3c1b659d59a7c675ffe15622d467e454f2fb8)
: iptables failed: iptables --wait -t nat -A DOCKER 7.0.3:8080 ! -i docker0: iptables: No chain/target/match by that name.
 (exit status 1).
[root@centos4 ~]# pkill docker
[root@centos4 ~]# iptables -t nat -F
[root@centos4 ~]# ifconfig docker0 down
[root@centos4 ~]# brctl delbr docker
bridge docker doesn't exist; can't delete it
[root@centos4 ~]# brctl delbr docker0
[root@centos4 ~]# systemctl start docker
[root@centos4 ~]# docker images
REPOSITORY                   TAG                 IMAGE ID            CREATED             SIZE
registry/django              v1                  6fe18247a725        2 days ago          111.7 MB
docker.io/mariadb            latest              58eaa7e4afb7        10 days ago         395.8 MB
docker.io/ubuntu             latest              0458a4468cbc        4 weeks ago         111.7 MB
docker.io/registry           latest              d1fd7d86a825        6 weeks ago         33.26 MB
docker.io/nginx              latest              3f8a4339aadd        8 weeks ago         108.5 MB
127.0.0.1:5000/hello-world   latest              f2a91732366c        3 months ago        1.848 kB
docker.io/hello-world        latest              f2a91732366c        3 months ago        1.848 kB
hello                        latest              f2a91732366c        3 months ago        1.848 kB
docker.io/django             latest              eb40dcf64078        14 months ago       436 MB
[root@centos4 ~]# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                   
 NAMES
d6bb2b0cf809        registry            "/entrypoint.sh /etc/"   9 days ago          Up 15 seconds       0.0.0.0:5000->5000/tcp 
  registry
[root@centos4 ~]# docker run -itd -p 8080:80  --name=django eb4
/usr/bin/docker-current: Error response from daemon: Conflict. The name "/django" is already in use by container f270ba90282a36
493ce3f7226adc65222d10a643beb3bb07e28d4ae22911ba6c.
You have to remove (or rename) that container to be able to reuse that name..
See '/usr/bin/docker-current run --help'.
[root@centos4 ~]# ./rm_contain.sh 
f270ba90282a
Error response from daemon: You cannot remove a running container d6bb2b0cf809df573b7c0d16dd9e9110a9da6331a2e9a5433fb52df
a9a64307a. Stop the container before attempting removal or use -f
[root@centos4 ~]# docker run -itd -p 8080:80  --name=django eb4
5eb0fa5abcfaa20b3237ddd2012b3a205a56c361f2eaa14e13b606410a042875
[root@centos4 ~]# 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值