There are two options to support running Linux containers on Windows; Docker Desktop and Docker under WSL2. Docker Desktop may require a subscription for business use. However, it is easy to set up and run. In addition, it provides a simple way to work on Windows Containers. Here is an overview of the two:

Category Docker Desktop WSL2 Docker
Resources Light Very Light
Availability Global Distro
Ease of Use Easy Moderate
License Business - $ Free
Windows Containers Yes No

Resources

Both the Docker Desktop and the WSL2 Docker are light on resources. Take, for example, my oldest machine, the 1st generation Surface Pro. With a humble 4GB of RAM, I can build and run containers, have an instance of WSL2 running for development, VS Code, and still squeeze in several browser tabs. That said, WSL2 Docker gets a slight lead here, as there is no desktop client or additional WSL2 distros that need to run.

The startup time for Docker Desktop is a lot longer than WSL2 Docker. It took over a minute for Docker Desktop to start. Half of that time was bringing up the application, and the other half was waiting for the docker icon in the system tray to indicate it was ready. Compare that to WSL2 Docker, which started in less than 5 seconds. That time also includes bringing up the WSL2 distro as well.

Engine Startup Time
Docker Desktop 68s
WSL2 Docker 3.54s

Once things are up and running, performance becomes similar between the two.

Operation Docker Desktop WSL2 Docker
split 50k files 6.87s 4.07s
rm 50k files 2.66s 2.05s

Benchmarks performed on a 1st generation Surface Pro with 64GB SSD. Your results will see improvement with better hardware.

Availability

When Docker Desktop is installed, the client is available in the Windows Console, under both the Command Prompt and PowerShell. It can also be added to any WSL2 distro with a few clicks in the desktop app. There is no need to install the client for that distro; Docker will stub out everything in it with a single click.

Docker Desktop WSL Integration

The WSL2 Docker will, by default, use /var/run/docker.sock in the distro. Only the client on the same distro can use the Docker daemon.

Ease of Use

Docker provides a desktop application to configure the Docker daemon and enable WSL integration with other distros. In addition, it also gives a friendly visual interface for managing images, containers, and volumes.

This is in contrast to WSL2 Docker, where you manage it as you would in Linux, via the JSON configuration file /etc/docker/daemon.json and using the client command-line interface (CLI) to handle container images, running containers, and so forth.

License

Docker Desktop is free for businesses with less than 250 employees and $10 million in annual revenue at the time of this writing. Otherwise, it is a minimum of $5 per month per user. Docker in WSL2 uses the open-source components of Docker, such as containerd, and is free to use.

Windows Containers

For Docker Desktop, right-click the application in the system tray and select Switch to Windows Containers. WSL2 Docker will only run Linux containers.

Docker Desktop

Installing Docker Desktop is a piece of cake. They even provide a tutorial once the application is running to guide you through running a container. See https://docs.docker.com/desktop/windows/install/

Historically, Docker Desktop used to run a dedicated VM. Now, by default, it runs on top of WSL2. Technically, it is still a VM but is highly optimized for resource conservation. I evaluated it using a 1st gen Surface Pro with just 4GB of RAM while having VS Code, a dozen tabs, and Spotify playing in the background. The older dedicated VM implementation would require at decent chunk of free memory to start it successfully, so the only way to launch Docker on 4GB of RAM was after a reboot.

Docker Desktop installs two distros in WSL. One is docker-desktop, a lightweight distro based on BusyBox that runs the Docker daemon and a host of other processes. And docker-desktop-data, which contains what appears to be cached build layers from built containers.

$ wsl.exe -l -v
  NAME                   STATE           VERSION
* Ubuntu                 Running         2
  docker-desktop-data    Running         2
  docker-desktop         Running         2

Cross Distro Support

When a WSL2 distro is integrated with Docker Desktop, it will run a process called docker-desktop-proxy

$ ps aux | grep docker
root 5632  /wsl/docker-desktop/docker-desktop-proxy --distro-name Ubuntu --docker-desktop-root /wsl/docker-desktop

It will also set up docker.sock under /var/run and provide symbolic links under /usr/bin programs like the docker client and docker-compose.

Lastly, it mounts directories between the Docker distros and your chosen distros, under /wsl. This is, for now, an undocumented feature of WSL that Docker Desktop utilizes. See WSL GitHub issues #4577 and #5177 for further information.

This enables Docker Desktop to work across distros, using the same Docker daemon.

Docker on WSL2

Installing Docker in WSL2 is the same as it is under Linux. Update the package tool to use Docker’s package repository and install all the needed components that makeup Docker.

https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository

In addition, you may want to add your user account to the docker group.

https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user

With that, you should be all set with Docker in WSL2.

$ sudo service docker start
$ docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.
...

Starting Docker automatically

If you are on Windows 11, you may be able to support systemd for WSL2. You can use the same configuration as Linux to have Docker Start on boot.

If systemd is not supported on your system, there is a quick way to have Docker start when you log in to Windows.

First, get the distro name that you installed Docker on.

$ wsl.exe -l -v
  NAME      STATE           VERSION
* Ubuntu    Running         2

In my case, the distro name is Ubuntu. Open the Windows Run Dialog (WIN + R) and enter shell:startup. The file explorer will open the startup folder for your user account. Create a batch file such as wsl_boot_script.bat and add the following to the script:

wsl -d Ubuntu -u root -e sudo service docker start

And that’s it! Next time you log in to your Windows account, the script will start Docker.