Are you a Windows user who has tried to run Docker and felt like you were losing your mind? You are not alone. Many have given up, convinced that a smooth Docker experience is only possible on macOS or Linux. But that couldn’t be further from the truth. There is a method that provides the speed of native Linux, the simplicity of a few commands, and a workflow that doesn’t make you want to pull your hair out.
Let’s cut through the noise and show you the straightforward, modern approach to running Docker on Windows without the headaches.
My previous Docker setup on Windows
It was tedious
When I first started with Docker, I quickly realized there wasn’t just one way to do it. You could use a traditional virtual machine like I did, manually installing a full Linux distribution like Ubuntu with Oracle VirtualBox. But it’s a method I don’t recommend to everyone.
It includes steps like installing VirtualBox, enabling hardware virtualization, downloading the Ubuntu server image and importing it into VirtualBox. Overall, the entire process was tedious and felt more like a chore than a development task.
But I finally found a method that works. It’s the approach that bypasses all the complexity, gives you incredible speed, and provides a workflow that’s simple.
Running Docker through the WSL 2 backend
Recommended method
What makes the new approach so much better is its deep integration with Windows Subsystem for Linux 2 (WSL2). Instead of wrestling with a bulky, separate VM like the one I used to manage, Docker Desktop now uses WSL2 as its backend.
The biggest advantage is that WSL2 is a lightweight virtual machine that runs a full Linux kernel right on your Windows machine, but without all the heavy overhead of a traditional VM.
With WSL2, the file system performance is lightning-fast, and my containers start up in seconds. It feels like I’m running Docker on a native Linux machine, but I still have all the convenience and power of my Windows applications and IDEs. It’s the best of both worlds and the reason I can say I enjoy using Docker on my Windows machine. Let’s set it up.
Confirm system requirements
A crucial part of the process
Before you go ahead and install Docker, make sure your Windows machine meets all the requirements. First, we need to verify the WSL installation. You can press the Windows + R keys, type cmd, and press Enter.
Now, type WSL and press Enter to see if it’s installed. If WSL isn’t installed, like in my case, as shown in the screenshot, proceed by typing WSL –-install and pressing Enter. The installation process should start automatically.
Once the WSL installation is complete, it’s important to reboot the PC to apply the changes. Now, it’s time to enable Windows Subsystem for Linux from the Control Panel.
You can search for Turn Windows features on or off from the start menu, press Enter, and enable the same (Windows Subsystem for Linux) from the following menu. You need to reboot the PC once again.
Now, finally, it’s important to verify that hardware virtualization is enabled on your PC. To confirm the same, head to the Windows Task Manager -> Performance -> CPU menu. If it’s not enabled, you need to switch it on from the device’s BIOS menu.
Install and launch Docker Desktop
You are good to go now
Docker offers native apps for Windows, Mac, and Linux. As for Windows, you can either install it from the official website or head to the Microsoft Store to search and download it.
Once the download process completes, launch Docker and go through the steps to set it up. It asks for your work or personal ID, but you can skip it and head straight to the main page.
If you have used Docker on Mac or Linux before, you will find yourself right at home with the Windows app. You can find containers, images, volumes, and builds from the sidebar and access the Docker Hub from the same. There is also an option to launch Terminal from the bottom.
If you are new to Docker, make sure to avoid several mistakes. You can refer to my dedicated post to learn about some of the Docker mistakes I made during my early days with it.
Docker on Windows sanity check
By leveraging Docker Desktop with the power of WSL2, you have moved past the common frustrations that once made Docker on Windows a headache. This isn’t about getting Docker to run on your desktop. After all, there are many ways to achieve the same. It’s about building a development environment that’s fast, efficient, and enjoyable to use.