Closed KSiig closed 5 years ago
Having the same issue. It blocks building of any images that require package installation, so it's pretty serious.
I've got the same issue with timeout, except it does not even work with --network host
docker run --network host hello-world Unable to find image 'hello-world:latest' locally docker: Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 192.168.141.81:53: read udp 192.168.141.92:49395->192.168.141.81:53: i/o timeout. See 'docker run --help'.
@KSiig how have you intalled docker in wsl2? Are you running curl also in wsl2? Are you running Docker Desktop as well? I cannot reproduce the problem. I installed dockerd with the get.docker.com script, started dockerd and started the nginx container. Running curl inside wsl2 works for me regardless of the --network option. Only thing is when you want to run curl.exe from eg. a powershell terminal you have to use the IP address of the wsl2 vm. Run eg. ip addr show dev eth0
and grab the IP address and use this instead of localhost.
We at Docker are working to improve the experience in wsl2 and we'll give an overview of that in a blog post very soon.
@patpilus it seems you have a different network issue, maybe running in a corporate network? DNS lookup for the Docker Hub registry doesn't seem to work.
@StefanScherer Here's what I have done so far:
At this point, I was trying to run services with docker-compose. One service has a Dockerfile with apt-get install
in it. The image for this service failed to build because archive.ubuntu.com was unreachable from inside the container. First, I thought it was a DNS issue and tried adding DNS servers to daemon.json. The values were successfully passed into the container but no host could be reached nonetheless.
Running curl inside wsl2 works for me regardless of the --network option
curl inside wsl2 has nothing to do with Docker. It works for me as well.
Only thing is when you want to run curl.exe from eg. a powershell terminal you have to use the IP address of the wsl2 vm.
Again, this is a whole different case.
We at Docker are working to improve the experience in wsl2 and we'll give an overview of that in a blog post very soon.
You are doing fantastic job, thank you! The only issue I have with running Docker inside WSL2 for now is this one we're discussing, and I can work around that by building my images manually with --network=host
. This is inconvenient but usable. Other than that, it works like charm.
I used to use Docker Desktop under Powershell, and it was awesome too. I'd like to switch to WSL2-based Docker just for the sake of lower memory usage and shell speed (pwsh is cool but slow).
@patpilus This is an unrelated issue, it seems like Docker registry is just unreachable from your machine. To make it clear: it's not the Internet being unreachable from inside a running container, it's one particular host being unreachable from the host machine.
@StefanScherer I initially installed Docker by following this tutorial on DigitalOcean: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04
However I had nothing important on WSL, so I deleted my Ubuntu distro and reinstalled it. Then I tried installing Docker from https://get.docker.com, and now it works. Also to answer your question: Yes I was running curl from within WSL.
Although I still think it's weird that it didn't work at first, I think we can classify this as fixed. Apparently you just need to install using get.docker.com (makes sense too).
I got same problem here. I just uninstalled docker using official procedure and then installed Docker using the helper script from https://get.docker.com.
Please fill out the below information:
ver
at a Windows Command Prompt)Microsoft Windows [Version 10.0.18917.1000]
I'm trying to run a simple Nginx container. I first tried with the following command:
docker run -d -p 80:80 nginx
curl localhost
What happens is that the
curl
ends up timing out. I can then add the container to the host network:docker run -d -p 80:80 --network host nginx
And then things are working exactly as they should.I'm running
Docker version 18.09.6, build 481bc77
, both on WSL 2, and on my bare metal Ubuntu 18.04 LTS server. When I run it on my bare metal server, everything works just as expected. That's the reason why I'm posting this as an issue here, and not on Docker.