Running Docker on WSL2 natively. Problem connecting to the doemon without localhost

Hi guys,
I’m new to Docker but I’ve been following the development of WSL2 for quite some time. Just a few days ago, Microsoft released the build 2020 for the insider program, which includes the new WSL2.
I have tried to install docker to run directly on the subsystem and it boots up without any problem.
Unfortunately, though there is a bug with WSL2 so basically we can not use localhost address at the moment.

So I set up a known static IP on my machine and then I applied the following changes the docker host:
export DOCKER_HOST=ip.add.of.my.machine:2375

I also changed the Windows Firewall config to ensure that incoming connections to the port 2375 are not blocked.

But I keep getting a connection refused error. Any ideas?

Hi, not sure if you are experiencing the same issue I just did. Installed Docker per the Ubuntu instructions into WSL2. Tried to run sudo docker run hello-world and got the connection error. Ran sudo service docker start then reran sudo docker run hello-world and it worked. Hopefully that addresses the issue you are experiencing.

1 Like

Can you give us the link to this issue please?

Hello guys, sorry for the slow response but I’m very busy these days. This is the link WSL2 on Microsoft website

Hmm, I’m not sure about that but I’ll check it out as soon as I can. Thank you for your feedback

this actually worked for me! thanks