Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux Docker错误:无法连接到deb.debian.org(111:连接被拒绝)_Linux_Windows_Docker_Ssl_Debian - Fatal编程技术网

Linux Docker错误:无法连接到deb.debian.org(111:连接被拒绝)

Linux Docker错误:无法连接到deb.debian.org(111:连接被拒绝),linux,windows,docker,ssl,debian,Linux,Windows,Docker,Ssl,Debian,我在Windows10上使用Docker创建Debian映像。但是,我相信Docker Desktop、Dockerfile或Docker命令中有错误 在Docker Desktop中,我对默认配置进行了三次更改 在General下,我打开了Expose daemontcp://localhost:2375 没有TLS 在Resources>Proxies下,我配置了http和https 在WSL集成下,我开启了Ubuntu 18.04 导致问题的Dockerfile如下所示: FROM deb

我在Windows10上使用Docker创建Debian映像。但是,我相信Docker Desktop、Dockerfile或Docker命令中有错误

在Docker Desktop中,我对默认配置进行了三次更改

  • 在General下,我打开了
    Expose daemontcp://localhost:2375 没有TLS
  • 在Resources>Proxies下,我配置了
    http
    https
  • 在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" ]
    
    >>> docker build simple-example
    
    如果有帮助,此备选Dockerfile运行时不会出现问题:

    我用于构建Docker文件的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 build simple-example
    
    注意:
    Dockerfile
    是目录
    简单示例
    中唯一的文件

    鉴于Docker Desktop配置,尝试使用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桌面、Dockerfile或Docker命令——导致了此错误?我应该怎么做才能修复它?

    试着在Dockerfile中放两行:

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