DEV Community

Discussion on: Running Docker on WSL2 without Docker Desktop (the right way)

Collapse
 
nmtoken profile image
James Passmore • Edited

Going just with adding the boot command to wsl.conf, I don't get a permission denied error, but 'docker version' gives version information and the Cannot connect to the Docker daemon at unix:///var/run/docker.sock.... error. using command = "sudo service docker start" has the same effect. Editing the .profile does work though

Collapse
 
jledesma84 profile image
jledesma84

I have the same issue. I'm using WSL2. Any solution?

Collapse
 
lemosluan profile image
Luan Lemos Almeida

I've the same issue, and using wsl2 and ubuntu 22.04;

I found the possible reason.
If you are using debian or some ubuntu version that has iptables-nft as default:
Install Docker on Windows (WSL) without Docker Desktop.

Try it

sudo update-alternatives --config iptables

and change it to iptable-legacy

It works for me. ;)

Thread Thread
 
felipecrs profile image
Felipe Santos

That's interesting to know about. I haven't tried yet with Ubuntu 22.04, but I will try and update the guide in case something like this is missing. Thank you!

Thread Thread
 
felipecrs profile image
Felipe Santos • Edited

It turns out that it's indeed necessary for Ubuntu 22.04 on WSL. So, I added instructions for it in the guide. Thanks again for pointing out!

Thread Thread
 
felipecrs profile image
Felipe Santos

Just to update you, later versions of docker seems to have fixed the issue without requiring this step so I have removed it from the guide.

Collapse
 
felipecrs profile image
Felipe Santos • Edited

This specific feature is only available in Windows 11. See the link below for reference.

I also updated the guide to make this clearer.

docs.microsoft.com/en-us/windows/w...

But you can, of course, just use the alternative approach as the guide mentions.

Collapse
 
felipecrs profile image
Felipe Santos

Most likely your WSL version isn't new enough to support this feature.