Issue
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.
In Docker Desktop, I have made three changes to the default configuration.
- Under General I have turned on
Expose daemon on tcp://localhost:2375 without TLS
. - Under Resources > Proxies, I have
http
andhttps
configured. - Under WSL Integration I have Ubuntu 18.04 turned on.
The Dockerfile that results in problems is as follows:
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" ]
If it helps, this alternative Dockerfile runs without problems:
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" ]
The Docker command I use to build the Dockerfile is as follows:
>>> docker build simple-example
Note: Dockerfile
is the only file in directory simple-example
.
Attempting to build the Dockerfile with the Docker command given the Docker Desktop configuration results in the following error:
(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
Which of these three -- Docker Desktop, Dockerfile, or Docker command -- is causing this error? What should I do to fix it?
Solution
Try putting these two lines in your Dockerfile:
ENV http_proxy=http:...
ENV https_proxy=http:...
Answered By - Philippe Answer Checked By - Timothy Miller (WPSolving Admin)