Ditching Docker Desktop on Windows 11 for Pure WSL2 Docker
If you run local AI models, ComfyUI workflows, or multi-container dev stacks on a Windows 11 workstation, you have probably hit the familiar Docker Desktop wall: a heavy Electron UI sitting in your system tray, mysterious vmmem RAM spikes, and occasional hiccups when passing your NVIDIA GPU into containers.
After one too many background updates and memory-reclamation quirks, I uninstalled Docker Desktop completely and moved to running the native Linux Docker Engine directly inside WSL2 Ubuntu. The result is faster startup, lower idle memory, and a cleaner path to GPU acceleration.
Why Leave Docker Desktop Behind?
Docker Desktop is convenient when you are getting started, but under the hood on Windows 11 it is already running a Linux VM inside WSL2 (docker-desktop and docker-desktop-data distros). Keeping the desktop wrapper around adds:
- Extra overhead: An additional VM layer and GUI daemon competing for RAM.
- Licensing friction: Commercial licensing rules if you consult or run a business.
- Opaque networking and storage: Debugging bind mounts or NVIDIA runtime hooks is much simpler when you own
/etc/docker/daemon.jsondirectly inside Ubuntu.
Step 1: Cleanly Uninstall Docker Desktop
Before installing Docker inside Ubuntu, uninstall Docker Desktop from Windows Settings → Apps → Installed Apps and reboot. Afterward, verify that the old WSL distros are gone:
wsl --list --verbose
You should only see your primary Linux distribution (for example, Ubuntu-24.04) running on VERSION 2.
Step 2: Enable systemd in WSL2
Modern WSL2 supports systemd, which lets the Docker daemon start automatically just like it does on a native Linux server. Inside Ubuntu, check /etc/wsl.conf:
[boot]
systemd=true
If you had to add it, shut down WSL from PowerShell (wsl --shutdown) and reopen your Ubuntu terminal.
Step 3: Install Native Docker Engine in Ubuntu
Install the official Docker Engine packages directly from Docker's apt repository rather than the outdated distro defaults:
sudo apt-get update
sudo apt-get install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Add your user to the docker group so you do not need sudo on every command:
sudo usermod -aG docker $USER
newgrp docker
Step 4: Wire Up NVIDIA GPU Passthrough
One of the biggest wins of native WSL2 Docker is how cleanly it pairs with the NVIDIA Container Toolkit. Make sure your Windows host has the latest Game Ready or Studio NVIDIA driver installed (never install a separate Linux display driver inside WSL2). Then, inside Ubuntu:
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
Test GPU access inside a container:
docker run --rm --gpus all nvidia/cuda:12.4.1-base-ubuntu22.04 nvidia-smi
If nvidia-smi prints your GPU and driver version, you are done.
Step 5: Cap WSL2 Memory (So Windows Doesn't Choke)
Create or edit C:\Users\<YourUser>\.wslconfig on the Windows side to keep memory usage predictable:
[wsl2]
memory=24GB
processors=8
autoMemoryReclaim=gradual
The Payoff
Once you live in pure WSL2 Docker for a week, it is hard to go back. Keep your source code inside the Linux filesystem (/home/<user>/projects) rather than /mnt/c to avoid cross-OS I/O penalties, use docker compose natively from your terminal, and enjoy a workstation that behaves like a proper Linux box without giving up Windows.
