Live data from Hacker News

Install Docker in WSL 2 Without Docker Desktop

nickjanetakis.com

1–10 of 25 posts

Re: Install Docker in WSL 2 Without Docker Desktop

#3

Nice, I'll take a look. This has been my go-to reference up 'til now https://dev.to/bowmanjd/install-docker-on-windows-wsl-withou...

Thanks. I had looked at that reference originally too but it does a lot of things unrelated to running Docker on WSL 2 and overcomplicates running Docker.

Realistically getting Docker to run on WSL 2 involves running a few standard install steps from Docker for installing Docker and Docker Compose v2 on Linux (such as Ubuntu, Debian or whatever distro you prefer) and then adding a 3 line shell script to your ~/.profile to ensure the init.d based Docker service starts when your WSL 2 process starts -- that's it.

I've been running this set up for months, it's super solid.

Re: Install Docker in WSL 2 Without Docker Desktop

#4
post #3

Nice, I'll take a look. This has been my go-to reference up 'til now https://dev.to/bowmanjd/install-docker-on-windows-wsl-withou...

Thanks. I had looked at that reference originally too but it does a lot of things unrelated to running Docker on WSL 2 and overcomplicates running Docker. Realistically getting Docker to run on WSL 2 involves running a few standard install steps from Docker for installing Docker and Docker Compose v2 on Linux (such as Ubuntu, Debian or whatever distro you prefer) and then adding a 3 line shell script to your ~/.profi…

Does this method still require hyper-v?

Re: Install Docker in WSL 2 Without Docker Desktop

#5
post #3

Earlier quoted context omitted.

Thanks. I had looked at that reference originally too but it does a lot of things unrelated to running Docker on WSL 2 and overcomplicates running Docker. Realistically getting Docker to run on WSL 2 involves running a few standard install steps from Docker for installing Docker and Docker Compose v2 on Linux (such as Ubuntu, Debian or whatever distro you prefer) and then adding a 3 line shell script to your ~/.profi…

Does this method still require hyper-v?

If you can run WSL 2 then you can use this method.

I personally run Windows 10 Pro which does have Hyper-V enabled (I use Hyper-V for standalone VMs unrelated to Docker) so I can't disable it to check for you but I'd say I'm 99.99% sure it'll work without Hyper-V because this is focused on running an application (Docker) inside of a WSL 2 environment. If WSL 2 is available to run then Docker can run in it because WSL 2 is providing the Linux environment. There is no separate VM running Docker.

Try it out and let us know.

Re: Install Docker in WSL 2 Without Docker Desktop

#7
post #3

Earlier quoted context omitted.

Thanks. I had looked at that reference originally too but it does a lot of things unrelated to running Docker on WSL 2 and overcomplicates running Docker. Realistically getting Docker to run on WSL 2 involves running a few standard install steps from Docker for installing Docker and Docker Compose v2 on Linux (such as Ubuntu, Debian or whatever distro you prefer) and then adding a 3 line shell script to your ~/.profi…

Does this method still require hyper-v?

That's the important question really. If it still requires a vm, then there is almost no difference between methods.

Re: Install Docker in WSL 2 Without Docker Desktop

#8

I was under the impression that docker installed in windows would manage system resources better than inside a wsl commissioner. I use lando, a docker compose wrapper. It’s instructions say to install docker inside wsl, but also warns of stability issues.

Last I checked, Docker desktop in windows requires a license for commercial users, whereas this method doesn't.

Re: Install Docker in WSL 2 Without Docker Desktop

#9
post #7

Earlier quoted context omitted.

Does this method still require hyper-v?

That's the important question really. If it still requires a vm, then there is almost no difference between methods.

Where I really need docker, I also need VMware workstation more. It’s been a limiting factor for me. Was asking to ensure this wasn’t some trickery but sounds promising. I already have WSL working just didn’t think to try docker in that layer!

Re: Install Docker in WSL 2 Without Docker Desktop

#10
post #5

Earlier quoted context omitted.

Does this method still require hyper-v?

If you can run WSL 2 then you can use this method. I personally run Windows 10 Pro which does have Hyper-V enabled (I use Hyper-V for standalone VMs unrelated to Docker) so I can't disable it to check for you but I'd say I'm 99.99% sure it'll work without Hyper-V because this is focused on running an application (Docker) inside of a WSL 2 environment. If WSL 2 is available to run then Docker can run in it because WSL…

WSL2 definitely works on Windows 10 Home, which doesn't have Hyper-V. My understanding is that they split off the VM functionality needed for WSL2 into the "Virtual Machine Platform" feature so that pro+ is no longer required.
Post reply on HN