Run Docker in WSL (Windows 10/11) without Docker Desktop
Install and Run Docker in WSL (Windows Subsystem for Linux for Windows 10/11) without Docker Desktop
To me Docker Desktop for Windows is annoying… It starts every time I start my Windows computer and I do not think it adds any value. I just want to use Docker like I am in Linux environment via a terminal. After spending some time researching how to do this, I found it is more straightforward than I thought.
This article is divided into two sections:
- Running Docker in WSL (Microsoft Store version)
- Running Docker in WSL (not Microsoft Store version)
Running Docker in WSL (Microsoft Store version)
As of September 21, 2022 WSL supports Systemd. Please refer to this article from Microsoft for details (https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/).
The following are the prerequisites:
- Install the Microsoft Store version of WSL or run “wsl — update” from the command prompt or Powershell.
If you already have a version of WSL installed on Windows then this will simply override (not overwrite) the existing WSL without impacting the existing Linux distribution/terminal environment.
- Check if you are running the Microsoft Store version of WSL version 0.67.6 and higher from the command prompt or the Powershell.
which should return something like this:
Here are the steps to install Docker and run Docker in WSL distro.
- Enable systemd
From the WSL distro (e.g., Ubuntu 22.04.1 LTS) terminal, edit /etc/wsl.conf file.
sudo nano /etc/wsl.conf