linux Docker错误:无法连接到deb.debian.org(111:连接被拒绝)[关闭]

xytpbqjk  于 11个月前  发布在  Linux
关注(0)|答案(2)|浏览(323)

**已关闭。**此问题不符合Stack Overflow guidelines。目前不接受回答。

此问题似乎与a specific programming problem, a software algorithm, or software tools primarily used by programmers无关。如果您认为此问题与another Stack Exchange site的主题相关,可以发表评论,说明在何处可以回答此问题。
去年关闭。
社区在10个月前审查了是否重新打开这个问题,并将其关闭:
原始关闭原因未解决
Improve this question
我在Windows 10上使用Docker创建Debian镜像。然而,我认为Docker Desktop,Dockerfile或Docker命令中有问题。
Docker Desktop中,我对默认配置做了三处修改。
1.在“常规”下,我打开了Expose daemon on tcp://localhost:2375 without TLS
1.在Resources > Proxies下,我配置了httphttps
1.在WSL集成下,我打开了Ubuntu 18.04。
导致问题的Dockerfile如下:

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" ]

字符串
如果有帮助,这个替代Dockerfile运行 * 没有问题 *:

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" ]


构建Dockerfile时使用的Docker命令如下:

>>> docker build simple-example


注意:Dockerfilesimple-example目录中唯一的文件。
Docker Desktop配置下,尝试使用Docker命令构建Dockerfile会导致以下错误:

(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 Desktop,Dockerfile或Docker命令-中的哪一个导致了这个错误?我应该做些什么来修复它?

v6ylcynt

v6ylcynt1#

在Resources > Proxies中使用http/https进行的配置在构建过程中似乎没有生效。
试着在你的Dockerfile中加入这两行:

ENV http_proxy=http:...
ENV https_proxy=http:...

字符串

zphenhs4

zphenhs42#

我遇到了这个问题。我尝试重新启动Docker,重新启动计算机,升级Docker桌面(我在Windows上,WSL 2),清除Docker缓存。没有任何效果。
最后什么解决了我的问题是重置路由器.我知道这听起来很愚蠢,因为互联网是工作的整个时间,我有网络甚至在WSL 2.所以我不能解释这个修复,但它的工作.

相关问题