TL;DR: Together, Docker Desktop and Windows Subsystem for Linux 2 provide a great experience for developing with Linux containers on Windows with a fast, efficient, and lightweight virtual machine. Docker Desktop uses WSL2 enhancements for faster boot times and greater system interoperability. And it’s easy to get started!

Using Linux containers for software development has many benefits. For instance, it allows you to quickly and simply run multiple, different versions of a database engine like MongoDB or SQL Server concurrently. You can also easily get project-specific code, such as APIs and integration tests, running locally in a matter of seconds with a few commands. The benefits go on.

Docker is a well-known front end for Linux containers, and it works on Windows, Linux, and MacOS. From the Docker website: “Docker simplifies and accelerates your workflow while giving developers the freedom to innovate with their choice of tools, application stacks, and deployment environments for each project.”

My own experience using Docker within the software consulting world has been positive: it’s easy to use and has been very beneficial to my software projects. Docker allows us to easily spin up the appropriate tools for the appropriate problem with very little overhead. For example, I was working with a client who had a MongoDB instance that held data for different services.  It was very easy just to start a Docker MongoDB container and have the setup we needed, instead of going through the process of installing MongoDB locally and managing versions. This also gave us the advantage of turning it off locally when we didn’t need it for the particular code we were working on.

Docker Desktop for Windows initially used heavy, full Virtual Machines on Hyper-V to run Linux containers. This isn’t necessarily bad, but it does cost overhead in speed and interoperability between the container and the Windows host.

With the evolution of Windows Subsystem for Linux (WSL) from WSL 1 to WSL2, Docker Desktop can now take advantage of a real, full implementation of the Linux Kernel in a lightweight virtual machine giving your containers speed and more seamless integration with Windows.

What is WSL2 and what does it do for Docker Desktop?

WSL2 is the current version of Windows Subsystem for Linux, Microsoft’s tools that allows developers to run a GNU/Linux environment directly on Windows. The goal of WSL is to provide a seamless bridge between Windows and Linux. This allows developers to use whatever environment they want and still work effectively as a team. For example, build scripts written on Debian can be run on WSL. With WSL, you can run several distributions of GNU/Linux right on Windows, including Ubuntu, Debian, and Kali.

WSL2 takes the greatness of WSL 1 and supercharges it by giving it a full Linux kernel, specially modified and designed by Microsoft to boost interoperability between the two systems, running on a lightweight, hands-off virtual machine. Microsoft says this is a different VM experience with better performance and the same great connected experience WSL 1 gives us. Another especially interesting feature is the remote capabilities that WSL2 offers, especially the integration with Visual Studio Code. A full list of differences and new features of WSL2 can be found here.

The new features and architecture make running WSL Docker containers with Docker Desktop faster and more efficient. Now, containers can boot in seconds and leverage the advantages of the full kernel. In addition, memory and CPU consumption is down. According to Docker themselves, “it takes less than 10 seconds to start the Docker daemon when compared to almost a minute in the previous version of Docker Desktop.”

Setting up WSL2 and Docker Desktop

Let’s look at how to make Docker and WSL2 work for you by walking through the setup process.

Installing WSL2 is straightforward. It’s even simpler if you have the Windows OS build 202562 or higher, which is part of the Windows Insiders Program at the time of this writing.

If you do have build 202562, you simply type the following in an Administrator command line window and restart: wsl.exe --install

This command does everything for you: enables WSL, installs Linux kernel, sets WSL2 as your default environment, and even downloads and installs a Linux distribution.

If you are not a part of the Windows Insiders Program, here are the steps to setting up WSL2.

  1. Enable WSL
  2. Update to WSL2
  3. Enable VM feature
  4. Download the Linux kernel update
  5. Set WSL2 as your default
  6. Install your Linux distro of choice from the Microsoft Store
  7. Restart Windows

You can find the details on installing WSL2 from Microsoft here.

Once you have WSL2 set up and running, you can get Docker Desktop working with it and enjoy better performance and interoperability. The following are the steps:

  1. Get Docker Desktop from here and install following their instructions. After Docker Desktop is installed it’s just a matter of settings.
  2. Open the settings from your system tray.
  3. wsl2 docker

  1. Under “General”, check the “Use the WSL2 based engine” setting.
  2. docker wsl 2 setting

  1. In Resources -> WSL INTEGRATION check the “Enable integration with my default WSL distro” setting. You can also enable it for all your distributions if you have more than one.
  2. Finally, reboot your computer and you have Docker Desktop with all the WSL2 advantages. You can create new containers inside of your Linux distribution or on Windows itself and Docker will use WSL2.
  3. docker wsl2 command line
    docker wsl2 containers

Bask in the benefits

Now that WSL2 is set up and Docker Desktop is installed and configured to use WSL2, your containers—and consequently your development—have been supercharged. The improved development experience you’re about to deliver will lead to faster and more high-quality throughput. In turn, this will provide more stable systems for your customers while delivering cost savings and improved overhead for your business.

Let's Talk


Newsletter | Get expert insights

Get expert insights

Join our newsletter to get valuable content delivered straight to your inbox