Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to pull images with WSL2 engine #6837

Open
2 tasks done
kobelobster opened this issue May 23, 2020 · 36 comments
Open
2 tasks done

Unable to pull images with WSL2 engine #6837

kobelobster opened this issue May 23, 2020 · 36 comments

Comments

@kobelobster
Copy link

  • I have tried with the latest version of my channel (Stable or Edge)
  • I have uploaded Diagnostics
  • Diagnostics ID: 58AC6771-806B-49B7-A768-71D7FE1BF58F/20200523095536

I have the same issue as in #6494, however I never had docker installed natively so I can't even uninstall it from WSL 2.

$ sudo apt-get remove docker docker-engine docker.io containerd runc
$ Reading package lists... Done
$ Building dependency tree
$ Reading state information... Done
$ Package 'docker-engine' is not installed, so not removed
$ Package 'docker' is not installed, so not removed
$ Package 'containerd' is not installed, so not removed
$ Package 'docker.io' is not installed, so not removed
$ Package 'runc' is not installed, so not removed
$ 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded

But running docker commands works without problems

$ docker --version
Docker version 19.03.8, build afacb8b7f0

However, when I now want to pull an image the image doesn't get pulled bc. of the error

Expected behavior

Actual behavior

$ docker-compose up
$ Pulling nginx (nginx:)...
$ latest: Pulling from library/nginx
$ afb6ec6fdc1c: Downloading [==================================================>]  41.06kB/41.06kB
$ b90c53a0b692: Download complete
$ 11fa52a0fdc0: Download complete
$ ERROR: unexpected EOF
$ docker-compose up
$ Pulling nginx (nginx:)...
$ ERROR: Get https://registry-1.docker.io/v2/library/nginx/manifests/latest: unexpected EOF

And even when not using docker-compose but docker I also get an error

$ docker run --name some-nginx -v /some/content:/usr/share/nginx/html:ro -d nginx
$ Unable to find image 'nginx:latest' locally
$ docker: Error response from daemon: Get https://registry-1.docker.io/v2/: EOF.
$ See 'docker run --help'.

Information

  • Windows Version: Version 2004 (Build 19041.264)
  • Docker Desktop Version: 2.3.0.2
  • Are you running inside a virtualized Windows e.g. on a cloud server or on a mac VM: In WSL 2

Steps to reproduce the behavior

This is a simple docker-compose.yaml I'm using, but like I said, even when using docker instead of docker-compose, I'm getting the same error

@bklooste
Copy link

The EOF suggest a networking / firewall issue ..

What happens if you get https://registry-1.docker.io/v2/library/nginx/manifests/latest with curl in WSL2 ?

When i try to get this it needs a password , Have you tried a simple hello world container ?

@pauxus
Copy link

pauxus commented May 31, 2020

same behaviour here. Curl to the failed url (https://auth.docker.io/token\?scope\=repository%3Alibrary%2Fbusybox%3Apull\&service\=registry.docker.io) works without a problem.

@kobelobster
Copy link
Author

Seems like I missed your comment @bklooste - For me it's the same as @pauxus . Curl works without any problems .

I tried other containers and they all had the same issues.

@TheForcer
Copy link

Currently facing the same issue here after a fresh Install of Windows, WSL2 Ubuntu 20.04 and Docker Desktop 2.3.0.3. Pulling any image from Docker Hub fails with the EOF error, but weirdly enough I can pull images from quay.io for example.

The curls from above also seem to require authentication on my side (am logged in).

@pranavagg
Copy link

Same issue here even with running hello-world
Somehow able to pull this docker run -dp 80:80 docker/getting-started

@PatrickGoettsch
Copy link

I am facing the same issue. I also run a fresh installation of Windows, WSL2, Ubuntu and Docker. In Docker I can login to docker. But on command line it fails most of the time. When I try to perfom
docker pull hello-world
I get the error:
Using default tag: latest Error response from daemon: Get https://registry-1.docker.io/v2/library/hello-world/manifests/latest: Get https://auth.docker.io/token?account=p***&scope=repository%3Alibrary%2Fhello-world%3Apull&service=registry.docker.io: unexpected EOF
While pulling
jugit-registry.fz-juelich.de/docker-images/gitlabci-latex
works directly. In the desktop app I am still logged in.
I tried to follow the idea with the proxy. But I have no proxy in my setup.

@kobelobster
Copy link
Author

I just re-installed Windows 2004 from scratch (before, I did an upgrade, so I thought a fresh install might work). Even when using the getting started image

❯ docker run -dp 80:80 docker/getting-started
Unable to find image 'docker/getting-started:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/docker/getting-started/manifests/latest: Get https://auth.docker.io/token?scope=repository%3Adocker%2Fgetting-started%3Apull&service=registry.docker.io: unexpected EOF.
See 'docker run --help'.

@mortensassi
Copy link

Same issue here, but only when i work directly in ~ When i am in /mnt/m/Sites/MySite the pull works correctly

@PatrickGoettsch
Copy link

I checked it on my system. First in a subdir of ~, it gave the same error and also on another HD. It still gives the same error. The docker desktop apllication says that I am logged in but I am not able to login on command line. There I also get an orror with EOF.

@mortensassi
Copy link

@PatrickGoettsch For me it was my router and after unchecking a setting it worked: This comment on another issue helped

@PatrickGoettsch
Copy link

Thanks. Changing this helped and solved the issue for the moment. But this rises a question wether this problem is related to Docker or to in my case AVM?

@kobelobster
Copy link
Author

I would say Docker for Windows OR WSL related. I have a FritzBox as well, but I don't have a problem with pulling docker images on native linux works without any problems. It's just inside WSL 2 it doesn't work. I also think in WSL1 it worked as well without any problems.

Maybe it's also a combination of the two.

@mortensassi
Copy link

@kobelobster which ISP do you use? according to other issues it could be related to Vodafone since all people who where affected were either unitymedia or vodafone customer

@kobelobster
Copy link
Author

@mortensassi I am a Vodafone customer, however, I'm a Vodafone customer as well when working with Linux or using Docker without WSL2 and there it works without any problems. So I fail to see how it can be only related to AVM or Vodafone, if it works with the same components without Windows/WSL2.

@sgtoj
Copy link

sgtoj commented Jul 23, 2020

I have a similar issue....

If I pull an image or build from an image not cached locally, it just hangs. No error is thrown. However, I am able to pull images if I use sudo.

@jernejg
Copy link

jernejg commented Jul 24, 2020

I have a similar issue....

If I pull an image or build from an image not cached locally, it just hangs. No error is thrown. However, I am able to pull images if I use sudo.

This started happening to me yesterday. But first I had to reset docker to factory defaults because I couldn't start it anymore after a Windows 10 Pro Insider Preview upgrade

@laser-me
Copy link

It also started for me.

As a workaround: I pull images in windows, after that they available in wsl2.

@rufdev
Copy link

rufdev commented Jul 28, 2020

I have a similar issue....

If I pull an image or build from an image not cached locally, it just hangs. No error is thrown. However, I am able to pull images if I use sudo.

same problem here. After i updated the latest insider preview i was getting stuck in pulling images. But i can pull image using windows command prompt. This error is only with wsl2. I cannot say that it is a problem with ISP since i was able to pull image on windows cmd.

@rufdev
Copy link

rufdev commented Jul 28, 2020

I have a similar issue....
If I pull an image or build from an image not cached locally, it just hangs. No error is thrown. However, I am able to pull images if I use sudo.

same problem here. After i updated the latest insider preview i was getting stuck in pulling images. But i can pull image using windows command prompt. This error is only with wsl2. I cannot say that it is a problem with ISP since i was able to pull image on windows cmd.

fixed by running with sudo

@patricknazar
Copy link

patricknazar commented Jul 28, 2020

I had the same problem and also couldn't build, and they were both related an auth issue. see my comment here

If you run docker-compose --verbose pull/build xyz and it gets stuck on auth, this could be your problem. In short: In an elevated powershell echo https://index.docker.io/v1/ | docker-credential-desktop.exe erase

Edit: ...and now it doesn't work. Arg.

Edit: Refer to #7808

@luislavena
Copy link

luislavena commented Jul 28, 2020

Same issue here, was only able to pull images within WSL2 by using sudo, but a regular Command Prompt work without issues:

Microsoft Windows [Version 10.0.20175.1000]
(c) 2020 Microsoft Corporation. All rights reserved.

C:\Users\Luis>where docker
C:\ProgramData\DockerDesktop\version-bin\docker
C:\ProgramData\DockerDesktop\version-bin\docker.exe

C:\Users\Luis>docker version
Client: Docker Engine - Community
 Azure integration  0.1.10
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        48a66213fe
 Built:             Mon Jun 22 15:43:18 2020
 OS/Arch:           windows/amd64
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          19.03.12
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       48a66213fe
  Built:            Mon Jun 22 15:49:27 2020
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          v1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

C:\Users\Luis>docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

C:\Users\Luis>docker pull alpine:latest
latest: Pulling from library/alpine
df20fa9351a1: Pull complete
Digest: sha256:185518070891758909c9f839cf4ca393ee977ac378609f700f60a771a2dfe321
Status: Downloaded newer image for alpine:latest
docker.io/library/alpine:latest

C:\Users\Luis>docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
alpine              latest              a24bb4013296        8 weeks ago         5.57MB

Now in WSL2 (Ubuntu-18.04 or Ubuntu-20.04 with Docker Desktop integration):

luis@Nostromo:~$ id
uid=1000(luis) gid=1000(luis) groups=1000(luis),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),117(netdev),1001(docker)

luis@Nostromo:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:        20.04
Codename:       focal

luis@Nostromo:~$ which docker
/usr/bin/docker

luis@Nostromo:~$ ll /usr/bin/docker
lrwxrwxrwx 1 root root 48 Jul 28 14:37 /usr/bin/docker -> /mnt/wsl/docker-desktop/cli-tools/usr/bin/docker*

luis@Nostromo:~$ docker version
Client: Docker Engine - Community
 Azure integration  0.1.10
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        48a66213fe
 Built:             Mon Jun 22 15:45:36 2020
 OS/Arch:           linux/amd64
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          19.03.12
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       48a66213fe
  Built:            Mon Jun 22 15:49:27 2020
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          v1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

luis@Nostromo:~$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
alpine              latest              a24bb4013296        8 weeks ago         5.57MB

luis@Nostromo:~$ docker pull alpine:3.11
(sits there, no output)
Ctrl+C

luis@Nostromo:~$ sudo docker pull alpine:3.11
3.11: Pulling from library/alpine
cbdbe7a5bc2a: Pull complete
Digest: sha256:9a839e63dad54c3a6d1834e29692c8492d93f90c59c978c1ed79109ea4fb9a54
Status: Downloaded newer image for alpine:3.11
docker.io/library/alpine:3.11

luis@Nostromo:~$ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
alpine              latest              a24bb4013296        8 weeks ago         5.57MB
alpine              3.11                f70734b6a266        3 months ago        5.61MB

@ThaDaVos
Copy link

Is there any fix for this? I can confirm pulling with sudo works, but I get an error when trying to do the same with docker-compose

@rikkit
Copy link

rikkit commented Aug 5, 2020

This workaround works for me - #7808 (comment)

@SangNguyenTL
Copy link

Laptop Asus reference this
#6622 (comment)

@docker-robott
Copy link
Collaborator

Issues go stale after 90 days of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30 days of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle stale

@ThaDaVos
Copy link

Issue still exists - so please no stale...

/remove-lifecycle stale

@ThaDaVos
Copy link

/lifecycle frozen

@EricHripko
Copy link

Observed something similar after upgrading to 4.2.0. This seems to be caused by ~/.docker/config.json, which points back to Windows for the credential store. If Docker Hub is for any reason inaccessible (e.g., is blocked or proxies are needed to access), docker CLI in WSL hangs for a long time (about 5 minutes) before doing anything. Removing ~/.docker/config.json seemed to fix the issue. This should explain why sudo docker pull works without delay, as root user doesn't have the harmful Docker Desktop configuration in its home folder.

@davidiw
Copy link

davidiw commented Apr 4, 2022

Observed something similar after upgrading to 4.2.0. This seems to be caused by ~/.docker/config.json, which points back to Windows for the credential store. If Docker Hub is for any reason inaccessible (e.g., is blocked or proxies are needed to access), docker CLI in WSL hangs for a long time (about 5 minutes) before doing anything. Removing ~/.docker/config.json seemed to fix the issue. This should explain why sudo docker pull works without delay, as root user doesn't have the harmful Docker Desktop configuration in its home folder.

+1

@yutsuo
Copy link

yutsuo commented Apr 6, 2022

Had the same issue, solved the same way as #6837 (comment)

@zem13579
Copy link

zem13579 commented Jul 3, 2022

I meet the same problem ,but solved it by switch on 'Enable integration with my default WSL distro ' ,
see detail in offical websiteDocker Desktop WSL 2 backend

@Cambridgeport90
Copy link

Same here...gonna try some of these options to figure out which one works. I'm wondering whether it's stuff like this why people in my circle recommend no production containers on Docker on Windows...well, production Linux containers, anyway?

@bvduijn
Copy link

bvduijn commented Mar 30, 2024

I got it working. I've created a .wslconfig in %userprofile% (e.g. c:\users<yourusername>) and added

[wsl2]
kernelCommandLine = cgroup_no_v1=all
dnsProxy = false

Then I modified /etc/wsl.conf in WSL

# Network host settings that enable the DNS server used by WSL 2. This example changes the hostname, sets generateResolvConf to false, preventing WSL from auto-generating /etc/resolv.conf, so that you can create your own (ie. nameserver 1.1.1.1).
[network]
hostname = ubuntu22-04-wsl
generateHosts = false
generateResolvConf = false

You probably don't need the hostname and generateHosts lines

After that I reboot WSL

Then resolv.conf wasn't available anymore in /etc so I created a new file:

sudo nano /etc/resolv.conf

search home.local
nameserver 192.168.40.1
nameserver 192.168.40.2

Change the nameservers to suit your needs.

One more reboot and I now got docker working in WSL2 with cgroups and able to pull images without sudo.

@Cambridgeport90
Copy link

Cambridgeport90 commented Apr 1, 2024 via email

@bvduijn
Copy link

bvduijn commented Apr 1, 2024

@Cambridgeport90 Not sure what you mean. If you want to pull public docker images you should be able to resolve public domain names. In my config I set it up to point to two pihole's but you could also point to to quad9 or something else.

@Cambridgeport90
Copy link

Cambridgeport90 commented Apr 1, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests