Docker Error: Could not connect to deb.debian.org (111: Connection refused)
Docker Error: Could not connect to deb.debian.org (111: Connection refused)
我在 Windows 10 使用 Docker 创建 Debian 映像。但是,我认为 Docker 桌面、Docker 文件或 Docker 命令有问题。
在Docker桌面中,我对默认配置进行了三处更改。
- 在常规下我已经打开
Expose daemon on tcp://localhost:2375 without TLS
。
- 在资源 > 代理下,我配置了
http
和 https
。
- 在 WSL 集成下,我打开了 Ubuntu 18.04。
导致问题的Docker文件如下:
FROM debian:buster-slim
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
RUN apt-get update --fix-missing && \
apt-get install -y wget && \
apt-get clean
CMD [ "/bin/bash" ]
如果有帮助,此替代 Docker 文件运行 没有问题:
FROM debian:buster-slim
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
RUN apt-get update --fix-missing && \
apt-get clean
CMD [ "/bin/bash" ]
我用来构建Docker文件的Docker命令如下:
>>> docker build simple-example
注意:Dockerfile
是目录 simple-example
中的唯一文件。
正在尝试使用 Docker 命令 构建 Docker 文件,给定 Docker 桌面 配置导致以下错误:
(base) C:\Users\usr1\Docker>docker build simple-example
[+] Building 25.4s (5/5) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 32B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/debian:buster-slim 2.9s
=> CACHED [1/2] FROM docker.io/library/debian:buster-slim@sha256:240f770008bdc538fecc8d3fa7a32a533eac55c14cbc56a9a8a6f7d741b47e33 0.0s
=> ERROR [2/2] RUN apt-get update --fix-missing && apt-get install -y wget && apt-get clean 22.4s
------
> [2/2] RUN apt-get update --fix-missing && apt-get install -y wget && apt-get clean:
#5 21.80 Err:1 http://deb.debian.org/debian buster InRelease
#5 21.80 Could not connect to deb.debian.org:80 (151.101.54.132). - connect (111: Connection refused) Could not connect to deb.debian.org:80 (151.101.54.132). - connect (111: Connection refused)
#5 21.80 Err:2 http://deb.debian.org/debian buster-updates InRelease
#5 21.80 Unable to connect to deb.debian.org:http:
#5 22.28 Err:3 http://security.debian.org/debian-security buster/updates InRelease
#5 22.28 Could not connect to security.debian.org:80 (151.101.0.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (151.101.64.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (151.101.128.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (151.101.192.204). - connect (111: Connection refused)
#5 22.29 Reading package lists...
#5 22.32 W: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease Could not connect to deb.debian.org:80 (151.101.54.132). - connect (111: Connection refused) Could not connect to deb.debian.org:80 (151.101.54.132). - connect (111: Connection refused)
#5 22.32 W: Failed to fetch http://security.debian.org/debian-security/dists/buster/updates/InRelease Could not connect to security.debian.org:80 (151.101.0.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (151.101.64.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (151.101.128.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (151.101.192.204). - connect (111: Connection refused)
#5 22.32 W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/InRelease Unable to connect to deb.debian.org:http:
#5 22.32 W: Some index files failed to download. They have been ignored, or old ones used instead.
#5 22.34 Reading package lists...
#5 22.35 Building dependency tree...
#5 22.35 Reading state information...
#5 22.35 E: Unable to locate package wget
------
executor failed running [/bin/sh -c apt-get update --fix-missing && apt-get install -y wget && apt-get clean]: exit code: 100
这三个 - Docker 桌面、Docker 文件或 Docker 命令 - 中的哪一个导致了此错误?我应该怎么做才能解决它?
尝试将这两行放入您的 Dockerfile 中:
ENV http_proxy=http:...
ENV https_proxy=http:...
我有这个问题。我尝试重新启动 docker、重新启动计算机、升级 docker 桌面(我在 windows、WSL2 上)、清除 docker 缓存。没有任何效果。
最终为我解决问题的是重置路由器。我知道这听起来很愚蠢,因为互联网一直在工作,而且我什至在 WSL2 中也有网络。所以我无法解释此修复,但它确实有效。
重新启动路由器对我没有帮助。我连接了移动互联网,这很有帮助。看来是提供商设备的问题。
我在 Windows 10 使用 Docker 创建 Debian 映像。但是,我认为 Docker 桌面、Docker 文件或 Docker 命令有问题。
在Docker桌面中,我对默认配置进行了三处更改。
- 在常规下我已经打开
Expose daemon on tcp://localhost:2375 without TLS
。 - 在资源 > 代理下,我配置了
http
和https
。 - 在 WSL 集成下,我打开了 Ubuntu 18.04。
导致问题的Docker文件如下:
FROM debian:buster-slim
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
RUN apt-get update --fix-missing && \
apt-get install -y wget && \
apt-get clean
CMD [ "/bin/bash" ]
如果有帮助,此替代 Docker 文件运行 没有问题:
FROM debian:buster-slim
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
RUN apt-get update --fix-missing && \
apt-get clean
CMD [ "/bin/bash" ]
我用来构建Docker文件的Docker命令如下:
>>> docker build simple-example
注意:Dockerfile
是目录 simple-example
中的唯一文件。
正在尝试使用 Docker 命令 构建 Docker 文件,给定 Docker 桌面 配置导致以下错误:
(base) C:\Users\usr1\Docker>docker build simple-example
[+] Building 25.4s (5/5) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 32B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/debian:buster-slim 2.9s
=> CACHED [1/2] FROM docker.io/library/debian:buster-slim@sha256:240f770008bdc538fecc8d3fa7a32a533eac55c14cbc56a9a8a6f7d741b47e33 0.0s
=> ERROR [2/2] RUN apt-get update --fix-missing && apt-get install -y wget && apt-get clean 22.4s
------
> [2/2] RUN apt-get update --fix-missing && apt-get install -y wget && apt-get clean:
#5 21.80 Err:1 http://deb.debian.org/debian buster InRelease
#5 21.80 Could not connect to deb.debian.org:80 (151.101.54.132). - connect (111: Connection refused) Could not connect to deb.debian.org:80 (151.101.54.132). - connect (111: Connection refused)
#5 21.80 Err:2 http://deb.debian.org/debian buster-updates InRelease
#5 21.80 Unable to connect to deb.debian.org:http:
#5 22.28 Err:3 http://security.debian.org/debian-security buster/updates InRelease
#5 22.28 Could not connect to security.debian.org:80 (151.101.0.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (151.101.64.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (151.101.128.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (151.101.192.204). - connect (111: Connection refused)
#5 22.29 Reading package lists...
#5 22.32 W: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease Could not connect to deb.debian.org:80 (151.101.54.132). - connect (111: Connection refused) Could not connect to deb.debian.org:80 (151.101.54.132). - connect (111: Connection refused)
#5 22.32 W: Failed to fetch http://security.debian.org/debian-security/dists/buster/updates/InRelease Could not connect to security.debian.org:80 (151.101.0.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (151.101.64.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (151.101.128.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (151.101.192.204). - connect (111: Connection refused)
#5 22.32 W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/InRelease Unable to connect to deb.debian.org:http:
#5 22.32 W: Some index files failed to download. They have been ignored, or old ones used instead.
#5 22.34 Reading package lists...
#5 22.35 Building dependency tree...
#5 22.35 Reading state information...
#5 22.35 E: Unable to locate package wget
------
executor failed running [/bin/sh -c apt-get update --fix-missing && apt-get install -y wget && apt-get clean]: exit code: 100
这三个 - Docker 桌面、Docker 文件或 Docker 命令 - 中的哪一个导致了此错误?我应该怎么做才能解决它?
尝试将这两行放入您的 Dockerfile 中:
ENV http_proxy=http:...
ENV https_proxy=http:...
我有这个问题。我尝试重新启动 docker、重新启动计算机、升级 docker 桌面(我在 windows、WSL2 上)、清除 docker 缓存。没有任何效果。
最终为我解决问题的是重置路由器。我知道这听起来很愚蠢,因为互联网一直在工作,而且我什至在 WSL2 中也有网络。所以我无法解释此修复,但它确实有效。
重新启动路由器对我没有帮助。我连接了移动互联网,这很有帮助。看来是提供商设备的问题。