docker / for-win

Bug reports for Docker Desktop for Windows
https://www.docker.com/products/docker#/windows
1.87k stars 292 forks source link

Unable to pull images with WSL2 engine #6837

Open kobelobster opened 4 years ago

kobelobster commented 4 years ago

I have the same issue as in https://github.com/docker/for-win/issues/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

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

PatrickGoettsch commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

PatrickGoettsch commented 4 years ago

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 commented 4 years ago

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

PatrickGoettsch commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

It also started for me.

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

rufdev commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

This workaround works for me - https://github.com/docker/for-win/issues/7808#issuecomment-664034094

SangNguyenTL commented 4 years ago

Laptop Asus reference this https://github.com/docker/for-win/issues/6622#issuecomment-678891982

docker-robott commented 3 years ago

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 commented 3 years ago

Issue still exists - so please no stale...

/remove-lifecycle stale

ThaDaVos commented 3 years ago

/lifecycle frozen

EricHripko commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

Had the same issue, solved the same way as https://github.com/docker/for-win/issues/6837#issuecomment-979881643

zem13579 commented 2 years ago

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 commented 8 months ago

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 commented 7 months ago

I got it working. I've created a .wslconfig in %userprofile% (e.g. c:\users\) 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 commented 7 months ago

Does this work if you are hosting your own DNS, as well? (I have Technitium set up as a forwarder zone for a bunch of my stuff, and then as a sinkhole, as well.) not sure if that would muck anything up inside of this configuration?

From: Bertvdn @.> Sent: Saturday, March 30, 2024 04:01 To: docker/for-win @.> Cc: Katherine Moss @.>; Comment @.> Subject: Re: [docker/for-win] Unable to pull images with WSL2 engine (#6837)

I got it working. I've created a .wslconfig in %userprofile% (e.g. c:\users) 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.

— Reply to this email directly, view it on GitHub https://github.com/docker/for-win/issues/6837#issuecomment-2027960269 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ADS4MAAW7RGRC3VVEEX7EZDY2ZPMRAVCNFSM4NIMHBQKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBSG44TMMBSGY4Q . You are receiving this because you commented. https://github.com/notifications/beacon/ADS4MAGV7U3HYMYMOVS5GU3Y2ZPMRA5CNFSM4NIMHBQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOPDQDPTI.gif Message ID: @. @.> >

bvduijn commented 7 months ago

@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 commented 7 months ago

That’s what I was trying to figure out. Thanks!ß

From: Bertvdn @.> Sent: Monday, April 1, 2024 10:29 To: docker/for-win @.> Cc: Katherine Moss @.>; Mention @.> Subject: Re: [docker/for-win] Unable to pull images with WSL2 engine (#6837)

@Cambridgeport90 https://github.com/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.

— Reply to this email directly, view it on GitHub https://github.com/docker/for-win/issues/6837#issuecomment-2029845577 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ADS4MAA375QUWOCDMUS6N53Y3FVJRAVCNFSM4NIMHBQKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBSHE4DINJVG43Q . You are receiving this because you were mentioned. https://github.com/notifications/beacon/ADS4MAFTVGEUJLW7X6HZJGTY3FVJRA5CNFSM4NIMHBQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOPD6PYSI.gif Message ID: @. @.> >