title: Docker Error: Could not connect to deb.debian.org (111: Connection refused)
body: <p>I am on Windows 10 using Docker to create a Debian image. However, I believe there is something wrong in the Docker Desktop, Dockerfile, or Docker command.</p>
  <p>In <strong>Docker Desktop</strong>, I have made three changes to the default configuration.</p>
  <ol>
  <li>Under General I have turned on <code>Expose daemon on tcp://localhost:2375 without TLS</code>.</li>
  <li>Under Resources &gt; Proxies, I have <code>http</code> and <code>https</code> configured.</li>
  <li>Under WSL Integration I have Ubuntu 18.04 turned on.</li>
  </ol>
  <p>The <strong>Dockerfile</strong> that results in problems is as follows:</p>
  <pre><code>FROM debian:buster-slim
  
  ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
  
  RUN apt-get update --fix-missing &amp;&amp; \
      apt-get install -y wget &amp;&amp; \
      apt-get clean
  
  CMD [ &quot;/bin/bash&quot; ]
  </code></pre>
  <p>If it helps, this alternative Dockerfile runs <em>without problems</em>:</p>
  <pre><code>FROM debian:buster-slim
  
  ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
  
  RUN apt-get update --fix-missing &amp;&amp; \
      apt-get clean
  
  CMD [ &quot;/bin/bash&quot; ]
  </code></pre>
  <p>The <strong>Docker command</strong> I use to build the Dockerfile is as follows:</p>
  <pre><code>&gt;&gt;&gt; docker build simple-example
  </code></pre>
  <p>Note: <code>Dockerfile</code> is the only file in directory <code>simple-example</code>.</p>
  <p>Attempting to build the <strong>Dockerfile</strong> with the <strong>Docker command</strong> given the <strong>Docker Desktop</strong> configuration results in the following error:</p>
  <pre><code>(base) C:\Users\usr1\Docker&gt;docker build simple-example
  [+] Building 25.4s (5/5) FINISHED
   =&gt; [internal] load build definition from Dockerfile                                                                                0.0s
   =&gt; =&gt; transferring dockerfile: 32B                                                                                                 0.0s
   =&gt; [internal] load .dockerignore                                                                                                   0.0s
   =&gt; =&gt; transferring context: 2B                                                                                                     0.0s
   =&gt; [internal] load metadata for docker.io/library/debian:buster-slim                                                               2.9s
   =&gt; CACHED [1/2] FROM docker.io/library/debian:buster-slim@sha256:240f770008bdc538fecc8d3fa7a32a533eac55c14cbc56a9a8a6f7d741b47e33  0.0s
   =&gt; ERROR [2/2] RUN apt-get update --fix-missing &amp;&amp;     apt-get install -y wget &amp;&amp;     apt-get clean                               22.4s
  ------
   &gt; [2/2] RUN apt-get update --fix-missing &amp;&amp;     apt-get install -y wget &amp;&amp;     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 &amp;&amp;     apt-get install -y wget &amp;&amp;     apt-get clean]: exit code: 100
  </code></pre>
  <p>Which of these three -- Docker Desktop, Dockerfile, or Docker command -- is causing this error? What should I do to fix it?</p>