Docker Desktop on Windows 11 with WSL 2: Install It Without the Usual Errors
I reinstalled my Windows 11 machine last month and wrote down every step of getting Docker Desktop running, mostly because I always forget one of them and end up searching the same error message again. This is that notes file, cleaned up a bit.
Check the hardware switch first
Before installing anything, open Task Manager, go to Performance, and look at the bottom right. It should say "Virtualization: Enabled". If it says Disabled, go into BIOS and turn on Intel VT-x or AMD-V. Docker Desktop on Windows today runs on WSL 2, which needs that switch, and no amount of reinstalling will fix a BIOS setting.
On a company laptop this may be blocked by policy. Ask IT before spending an evening on it.
Install WSL, then reboot
Open PowerShell as Administrator and run:
wsl --install
This installs the default Ubuntu distribution and enables the WSL and Virtual Machine Platform features. Reboot when it asks. Then check:
wsl --status
wsl -l -v
The first time I did this on an older machine, wsl --install returned "The service has not been started". A plain reboot fixed it. On a machine that already had WSL 1, I had to run wsl --set-default-version 2 before Docker would use the right backend.
If you want a specific distro, wsl --install -d Ubuntu-22.04 works, but skip the Microsoft Store if your company blocks it. A clean install is enough.
Install Docker Desktop
Download Docker Desktop from docker.com/products/docker-desktop, pick the Windows/amd64 installer unless you are on ARM, and run it. Keep "Use WSL 2 instead of Hyper-V" checked. It is the default now and it is the option you want.
After the first launch, open Settings, go to Resources, and point WSL integration at the distro you actually use. Then test from PowerShell:
docker run --rm hello-world
docker version
If docker version only shows the client and complains that the server is not reachable, the engine did not start. Look at Docker Desktop's own log through the tray icon before touching the CLI.
Three errors I actually hit
Docker Desktop - WSL distro terminated abruptly
This happened because I had installed a second distro while Docker was already running. Restart Docker Desktop from the tray, then run wsl --shutdown and start it again. Do not run wsl --shutdown while you have other terminal windows open; they will close.
unable to connect to the docker daemon at unix:///var/run/docker.sock
I hit this inside WSL, not in PowerShell. It means the WSL integration switch is off. In Docker Desktop, Settings > Resources > WSL Integration, enable your distro and apply. Then open a fresh WSL terminal; the old one will not pick up the change.
Hardware assisted virtualization not enabled on an older build
Same thing as the BIOS switch above. The wording changes between versions, the cause does not.
Give it sensible limits
Docker Desktop will happily take half your RAM. On a 16 GB laptop, set Memory to 8 GB and CPUs to 4 in Settings > Resources. On 32 GB, I leave memory at 12 GB and let the host breathe. Containers do not need more than that for normal development work.
Also turn on "Start Docker Desktop when you sign in" only if you actually use it every day. On my machine it added about eight seconds to login, so I turned it off.
The small thing that saved me later
I keep a text file with the three commands I run after every reinstall:
wsl --status
docker context ls
docker run --rm hello-world
It takes ten seconds and tells me whether the problem is WSL, the Docker context, or the engine itself. Most guides start with advanced configuration. For a fresh machine, the boring three-command check is what you need.
If you are on Windows 10 instead of 11, the steps are mostly the same but you need to enable WSL manually before wsl --install works well. That is a different notes file.