Install Docker in WSL 2 Without Docker Desktop
nickjanetakis.com
nickjanetakis.com
Using Docker inside WSL 2 has been painful for years, that's nice to see that things are getting better.
Either way, while I'm more than happy with Docker Desktop (my circumstances allow me to use it at no expense), there are also some promising projects out there that some of you might be interested in, provided that you want something more than just the CLI.
Podman Desktop: https://podman-desktop.io/
Rancher Desktop: https://rancherdesktop.io/
I/O performance is horrible in the second case. It's recommended to have your projects within WSL2. I've personally just bookmarked my projects folder that's within WSL2 so I can access it from Explorer as well.
Pros (for not using DD):
- You use less resources since you don't need a separate DD app running
- It's more close to the experience you'd have on a production server which wouldn't run DD
Cons (by not using DD): - If you like having a UI, you won't have it
- You can't use Docker extensions if that's something you want
- You have to install Docker in each WSL 2 instance instead of checking a checkbox in the DD UI
Neutral (in either case): - You can still access things on localhost without DD
- You can still run K8s directly in WSL 2 without DD using Kind and other tools
- Everything works the same, there's no limitations around Docker's core feature set
- Performance is really good (including volumes) as long as your files are in WSL 2's file system with or without DDRealistically 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.
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.
the Docker daemon and Docker CLI are open source and are free, even on Windows.