GVKun编程网logo

docker启动时报错Error response from daemon: driver failed programming external connectivity on endpoint *

25

如果您想了解docker启动时报错Errorresponsefromdaemon:driverfailedprogrammingexternalconnectivityonendpoint*的知识,那

如果您想了解docker启动时报错Error response from daemon: driver failed programming external connectivity on endpoint *的知识,那么本篇文章将是您的不二之选。同时我们将深入剖析Docker - 解决 Error response from daemon: driver failed programming external connectivity on endpoint tomcat9999、Docker Error response from daemon: driver failed programming external connectivity on endpoint webs、Docker 内 pip 安装 package 报错: Failed to establish a new connection: [Errno -3] Temporary failure in nam...、docker 出现 Error response from daemon的各个方面,并给出实际的案例分析,希望能帮助到您!

本文目录一览:

docker启动时报错Error response from daemon: driver failed programming external connectivity on endpoint *

docker启动时报错Error response from daemon: driver failed programming external connectivity on endpoint *

公司服务器由于断电重启,部署在docker服务上的一些web服务需要重新开启容器,

[root@localhost ~]# docker ps
CONTAINER ID        IMAGE                                                  COMMAND                  CREATED             STATUS              PORTS                     NAMES
d77c2c6b3650        chandao:latest                                         "/app/docker-entrypo…"   7 days ago          Up About an hour    0.0.0.0:7075->80/tcp      chandao

 

当重新开启容器的时候,web服务页面无法访问

[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE                                                  COMMAND                  CREATED             STATUS                           PORTS                                           NAMES
18807008623c        centos:latest                                          "/bin/bash"              3 days ago          Exited (255) About an hour ago                                                   heuristic_aryabhata
d77c2c6b3650        chandao:latest                                         "/app/docker-entrypo…"   7 days ago          Up About an hour                 0.0.0.0:7075                      ->80/tcp      chandao
12d299f61e0b        djltomcat:latest                                       "/root/run.sh"           2 weeks ago         Exited (255) About an hour ago   0.0.0.0:7074                      ->8080/tcp    kjxy
[root@localhost ~]# docker start kjxy
kjxy
[root@localhost ~]#
[root@localhost ~]# docker ps
CONTAINER ID        IMAGE                                                  COMMAND                  CREATED             STATUS              PORTS                                          NAMES
d77c2c6b3650        chandao:latest                                         "/app/docker-entrypo…"   7 days ago          Up About an hour    0.0.0.0:7075->80/tcp                           chandao
12d299f61e0b        djltomcat:latest                                       "/root/run.sh"           2 weeks ago         Up 27 seconds       0.0.0.0:7074->8080/tcp                         kjxy
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]#
[root@localhost ~]# systemctl is-active firewalld
inactive

 

于是重新启动了一下容器,报如下错误

[root@localhost ~]# docker stop kjxy
kjxy
[root@localhost ~]#
[root@localhost ~]# docker start kjxy
Error response from daemon: driver failed programming external connectivity on endpoint kjxy (d347e043e31906b2bcb2733437cc52fd96fc653c3fcca18b664f65940da9db79):  (ip                      tables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 7074 -j DNAT --to-destination 172.17.0.6:8080 ! -i docker0: iptables: No chain/target/match by                       that name.
 (exit status 1))
Error: failed to start containers: kjxy
[root@localhost ~]#

 

查看容器详细信息

[root@localhost ~]# docker inspect kjxy
[
    {
        "Id": "12d299f61e0bccd29d35bffe5e98ff6abba934673c457e50246d1a857ebe4374",
        "Created": "2019-03-05T05:22:35.219042191Z",
        "Path": "/root/run.sh",
        "Args": [],
        "State": {
            "Status": "exited",
            "Running": false,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 0,
            "ExitCode": 137,
            "Error": "driver failed programming external connectivity on endpoint kjxy (6206f4102fb1f8a007b2306fc9b9caa3e87abd8e00d4a26a78b72e2242292970):  (iptables                      failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 7074 -j DNAT --to-destination 172.17.0.6:8080 ! -i docker0: iptables: No chain/target/match by that nam                     e.\n (exit status 1))",
            "StartedAt": "2019-03-20T00:45:14.267504968Z",
            "FinishedAt": "2019-03-20T01:26:36.1111497Z"
        },

 

在网上找了一篇文章

原文链接

https://www.cnblogs.com/hailun1987/p/7518306.html

http://blog.sina.com.cn/s/blog_8ea8e9d50102wwf8.html

https://blog.csdn.net/czz1141979570/article/details/78752671

原因:

docker服务启动时定义的自定义链DOCKER由于某种原因被清掉
重启docker服务及可重新生成自定义链DOCKER

解决办法:

重启docker服务后再启动容器
systemctl restart docker

问题解决

end

Docker - 解决 Error response from daemon: driver failed programming external connectivity on endpoint tomcat9999

Docker - 解决 Error response from daemon: driver failed programming external connectivity on endpoint tomcat9999

问题背景

执行 docker start tomcat 报以下的错误

Error response from daemon: driver Failed programming external connectivity on endpoint tomcat9999 (f24431f0da474edbe79ba136b19079df3dcae89a4f688abe74cd0b993856a670):  (iptables Failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 8080 -j DNAT -

 

解决办法

docker服务启动时定义的自定义链DOCKER被清除,重启即可

systemctl restart docker

 

总结

以上是小编为你收集整理的Docker - 解决 Error response from daemon: driver failed programming external connectivity on endpoint tomcat9999全部内容。

如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。

Docker Error response from daemon: driver failed programming external connectivity on endpoint webs

Docker Error response from daemon: driver failed programming external connectivity on endpoint webs

按照官网的配置,

https://docs.docker.com/docker-for-windows/

当执行到第 5 步时

 

如果当前你的电脑 80 端口已经被别的程序占用,运行以上命令就会报错,报错如下:

报错信息显示有冲突

 

解决方法:

可以通过改变端口号解决,例如修改为 8080

docker run -d -p 8080:80 --name webserver Nginx

 

运行成功在浏览器打开 localhost:8080 :

 

Docker 内 pip 安装 package 报错: Failed to establish a new connection: [Errno -3] Temporary failure in nam...

Docker 内 pip 安装 package 报错: Failed to establish a new connection: [Errno -3] Temporary failure in nam...

说来奇幻 (对本菜来说,经常遇到堪称奇幻的问题)

之前在 docker 里面各种安装都没问题,也不知道什么引起的,昨天晚上调试的时候卸载了一个包的版本,然后就安不上了.

宿主机安装依然各种流畅,唯独 docker 容器不行.

网上找了许多方法,最后在 /etc/resolv.conf 文件内添加如下的代码解决了:

nameserver 8.8.8.8

https://blog.csdn.net/qq_17351077/article/details/77498173

上面的博客提到了这个方法,但是不明白什么原因,所以就没试,然后在

https://stackoverflow.com/questions/28668180/cant-install-pip-packages-inside-a-docker-container-with-ubuntu/41989423

上又找到了同样的方案,这次这哥们给了点说明:  Docker 没有使用正确的 DNS 服务器。将谷歌的 DNS 服务器地址 添加到那个配置文件

Your problem comes from the fact that Docker is not using the proper DNS server. You can fix it in three different ways :

1. Adding Google DNS to your local config

Modifying /etc/resolv.conf and adding the following lines at the end

# Google IPv4 nameservers nameserver 8.8.8.8 nameserver 8.8.4.4

If you want to add other DNS servers, have a look here.

However this change won''t be permanent (see this thread). To make it permanent : $ sudo nano /etc/dhcp/dhclient.conf Uncomment and edit the line with prepend domain-name-server : prepend domain-name-servers 8.8.8.8, 8.8.4.4;

Restart dhclient : $ sudo dhclient.

2. Modifying Docker config

As explained in the docs :

Systems that run Ubuntu or an Ubuntu derivative on the desktop typically use 127.0.0.1 as the default nameserver in /etc/resolv.conf file.

To specify a DNS server for use by Docker :

1. Log into Ubuntu as a user with sudo privileges.

2. Open the /etc/default/docker file for editing :

    $ sudo nano /etc/default/docker

3. Add the following setting for Docker.

    DOCKER_OPTS="--dns 8.8.8.8"

4. Save and close the file.

5. Restart the Docker daemon :

    $ sudo systemctl restart docker

3. Using a parameter when you run Docker

When you run docker, simply add the following parameter : --dns 8.8.8.8

 

我是用的第一个方法,虽然解决了,但是为什么之前都没出现这个问题呢?

我服务器默认的是阿里云的 DNS 服务器地址,查看了下我的电脑虚拟机的,用的是虚拟的局域网 IP 地址,

docker 会继承宿主机的 DNS 服务器地址,难不成是阿里云的 DNS 服务器的问题?但是我宿主机没事

 

docker 出现 Error response from daemon

docker 出现 Error response from daemon

第一步:通过 dig @114.114.114.114 registry-1.docker.io 找到可用 IP

navy@deepin:~/Desktop$ dig @114.114.114.114 registry-1.docker.io

; <<>> DiG 9.11.3-1-Debian <<>> @114.114.114.114 registry-1.docker.io
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14010
;; flags: qr rd ra; QUERY: 1, ANSWER: 8, AUTHORITY: 4, ADDITIONAL: 4

;; QUESTION SECTION:
;registry-1.docker.io.        IN    A

;; ANSWER SECTION:
registry-1.docker.io.    60    IN    A    34.200.28.105
registry-1.docker.io.    60    IN    A    52.22.67.152
registry-1.docker.io.    60    IN    A    52.70.175.131
registry-1.docker.io.    60    IN    A    52.22.201.61
registry-1.docker.io.    60    IN    A    52.54.155.177
registry-1.docker.io.    60    IN    A    52.206.40.44
registry-1.docker.io.    60    IN    A    54.175.43.85
registry-1.docker.io.    60    IN    A    54.165.149.19

;; AUTHORITY SECTION:
docker.io.        24420    IN    NS    ns-1827.awsdns-36.co.uk.
docker.io.        24420    IN    NS    ns-421.awsdns-52.com.
docker.io.        24420    IN    NS    ns-1168.awsdns-18.org.
docker.io.        24420    IN    NS    ns-513.awsdns-00.net.

;; ADDITIONAL SECTION:
ns-1827.awsdns-36.co.uk. 9556    IN    A    205.251.199.35
ns-421.awsdns-52.com.    541    IN    A    205.251.193.165
ns-1168.awsdns-18.org.    16170    IN    A    205.251.196.144
ns-513.awsdns-00.net.    13484    IN    A    205.251.194.1

;; Query time: 27 msec
;; SERVER: 114.114.114.114#53(114.114.114.114)
;; WHEN: Sun Nov 18 10:34:13 CST 2018
;; MSG SIZE  rcvd: 370

 

第二步:尝试修改 /etc/hosts 强制 docker.io 相关的域名解析到其它可用 IP

vim /etc/hosts

添加一个可用 IP:

34.200.28.105 registry-1.docker.io

保存之后重试:

navy@deepin:~/Desktop$ sudo docker pull ubuntu
Using default tag: latest
latest: Pulling from library/ubuntu
473ede7ed136: Pull complete 
c46b5fa4d940: Pull complete 
93ae3df89c92: Pull complete 
6b1eed27cade: Pull complete 
Digest: sha256:29934af957c53004d7fb6340139880d23fb1952505a15d69a03af0d1418878cb
Status: Downloaded newer image for ubuntu:latest

 

验证:

navy@deepin:~/Desktop$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              latest              ea4c82dcd15a        4 weeks ago         85.8MB

 

成功!

今天的关于docker启动时报错Error response from daemon: driver failed programming external connectivity on endpoint *的分享已经结束,谢谢您的关注,如果想了解更多关于Docker - 解决 Error response from daemon: driver failed programming external connectivity on endpoint tomcat9999、Docker Error response from daemon: driver failed programming external connectivity on endpoint webs、Docker 内 pip 安装 package 报错: Failed to establish a new connection: [Errno -3] Temporary failure in nam...、docker 出现 Error response from daemon的相关知识,请在本站进行查询。

本文标签: