Issue type
Docker containers are not able to access the internet. For example, "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz" is accessible from the browser on my laptop, but that same link is not accessible from a Docker container on the same laptop.
This happens regardless of whether the laptop is on a VPN or a trusted network.
Any commands in a Dockerfile that need to access the internet are failing (like npm install, apk-get, etc.).
Simple containers like hello-world do work fine.
WSL 2 is enabled on this laptop.
Running Linux Containers.
OS Version/build
Edition: Windows 10 Enterprise
Version: 21H2
OS Build: 19044.2364
App version
Docker Desktop 4.15.0 (93002)
C:\coding\docker\app>docker version
Client:
Cloud integration: v1.0.29
Version: 20.10.21
API version: 1.41
Go version: go1.18.7
Git commit: baeda1f
Built: Tue Oct 25 18:08:16 2022
OS/Arch: windows/amd64
Context: default
Experimental: true
Server: Docker Desktop 4.15.0 (93002)
Engine:
Version: 20.10.21
API version: 1.41 (minimum version 1.12)
Go version: go1.18.7
Git commit: 3056208
Built: Tue Oct 25 18:00:19 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.10
GitCommit: 770bd0108c32f3fb5c73ae1264f7e503fe7b2661
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Steps to reproduce
Execute the following command to see the issue:
docker build -t getting-started .
The output of that command on my laptop is:
C:\coding\docker\getting-started\app>docker build -t getting-started .
[+] Building 15.1s (12/12) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 186B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> resolve image config for docker.io/docker/dockerfile:1 2.1s
=> docker-image://docker.io/docker/dockerfile:1@sha256:9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c4e84ced81e24ef1a0dbc 1.2s
=> => resolve docker.io/docker/dockerfile:1@sha256:9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c4e84ced81e24ef1a0dbc 0.0s
=> => sha256:1328b32c40fca9bcf9d70d8eccb72eb873d1124d72dadce04db8badbe7b08546 9.94MB / 9.94MB 0.8s
=> => sha256:9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c4e84ced81e24ef1a0dbc 2.00kB / 2.00kB 0.0s
=> => sha256:ad87fb03593d1b71f9a1cfc1406c4aafcb253b1dabebf569768d6e6166836f34 528B / 528B 0.0s
=> => sha256:1e8a16826fd1c80a63fa6817a9c7284c94e40cded14a9b0d0d3722356efa47bd 2.37kB / 2.37kB 0.0s
=> => extracting sha256:1328b32c40fca9bcf9d70d8eccb72eb873d1124d72dadce04db8badbe7b08546 0.2s
=> [internal] load build definition from Dockerfile 0.0s
=> [internal] load .dockerignore 0.0s
=> [internal] load metadata for docker.io/library/node:18-alpine 1.1s
=> [internal] load build context 0.1s
=> => transferring context: 4.62MB 0.1s
=> [1/4] FROM docker.io/library/node:18-alpine@sha256:a136ed7b0df71082cdb171f36d640ea3b392a5c70401c642326acee767b8c540 8.1s
=> => resolve docker.io/library/node:18-alpine@sha256:a136ed7b0df71082cdb171f36d640ea3b392a5c70401c642326acee767b8c540 0.0s
=> => sha256:a136ed7b0df71082cdb171f36d640ea3b392a5c70401c642326acee767b8c540 1.43kB / 1.43kB 0.0s
=> => sha256:b375b98d1dcd56f5783efdd80a4d6ff5a0d6f3ce7921ec99c17851db6cba2a93 1.16kB / 1.16kB 0.0s
=> => sha256:6d7b7852bcd3b24b35483caa22beb6d0955bbe8018a652b2e0ebc26fcdbcff3c 6.44kB / 6.44kB 0.0s
=> => sha256:c158987b05517b6f2c5913f3acef1f2182a32345a304fe357e3ace5fadcad715 3.37MB / 3.37MB 0.4s
=> => sha256:aabd449b9131436e3664a0d3d1bc0e7b7c437baed49a2b9cd46c4131ad3358c3 46.59MB / 46.59MB 6.0s
=> => sha256:756e97429a305b467d7427f9497892c554c9104de2e5b567fabd97a9b391d5b5 2.35MB / 2.35MB 0.3s
=> => sha256:1ee3f64a4fc80ad4dc011a3c1f11aa6277993b521ff57d029a3af874bda042f6 453B / 453B 0.3s
=> => extracting sha256:c158987b05517b6f2c5913f3acef1f2182a32345a304fe357e3ace5fadcad715 0.1s
=> => extracting sha256:aabd449b9131436e3664a0d3d1bc0e7b7c437baed49a2b9cd46c4131ad3358c3 1.4s
=> => extracting sha256:756e97429a305b467d7427f9497892c554c9104de2e5b567fabd97a9b391d5b5 0.1s
=> => extracting sha256:1ee3f64a4fc80ad4dc011a3c1f11aa6277993b521ff57d029a3af874bda042f6 0.0s
=> [2/4] WORKDIR /app 0.8s
=> [3/4] COPY . . 0.1s
=> ERROR [4/4] RUN yarn install --production 1.1s
------
> [4/4] RUN yarn install --production:
#12 0.578 yarn install v1.22.19
#12 0.660 [1/4] Resolving packages...
#12 0.877 [2/4] Fetching packages...
#12 1.064 error An unexpected error occurred: "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz: connect ECONNREFUSED 104.16.16.35:443".
#12 1.065 info If you think this is a bug, please open a bug report with the information provided in "/app/yarn-error.log".
#12 1.065 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
------
executor failed running [/bin/sh -c yarn install --production]: exit code: 1
NOTE: This is the Getting Started sample application with the following Dockerfile (from https://docs.docker.com/get-started/02_our_app/):
# syntax=docker/dockerfile:1
FROM node:18-alpine
WORKDIR /app
COPY . .
RUN yarn install --production
CMD ["node", "src/index.js"]
EXPOSE 3000