Skip to content
daniel@cosenza:~/blog
WSLHow-To August 21, 2026 2 min read

How to Set Up Docker with the WSL2 Backend

A complete walkthrough getting Docker Desktop configured to use WSL2 as its backend, integrating specific distros, and verifying containers actually run using WSL2's real Linux kernel rather than a separate VM.

Docker Desktop’s WSL2 backend runs containers using WSL2’s own real Linux kernel rather than a separate, dedicated Hyper-V virtual machine — this walks through setting it up correctly.

Step 1: ensure WSL2 itself is installed and working

wsl --status

Confirm WSL2 (not just WSL1) is your default version before installing Docker Desktop, since the WSL2 backend specifically requires it.

Step 2: install Docker Desktop

Download Docker Desktop for Windows from Docker's
  official site and run the installer

Step 3: confirm the WSL2 backend is selected

Docker Desktop → Settings → General →
  confirm "Use the WSL 2 based engine" is checked

This should be the default on a current Docker Desktop installation, but worth confirming explicitly, especially on an upgraded older installation that might retain a prior Hyper-V-based configuration.

Step 4: enable integration for your specific distro

Docker Desktop → Settings → Resources → WSL Integration →
  toggle on for the specific distro(s) you want to
  use docker from

Integration is per-distro, not automatic for every installed distro — enable it specifically for whichever distro you actually intend to run docker commands from.

Step 5: apply the changes

Click "Apply & Restart" in Docker Desktop's settings

Step 6: verify docker works from inside the distro

docker --version
docker run hello-world

Successfully running the hello-world test container confirms the full integration path — Docker Desktop, WSL2, and your specific distro — is working correctly end to end.

Step 7: verify containers actually use the shared WSL2 kernel

uname -r

Run both inside your Docker container and inside your WSL distro directly — seeing the same kernel version confirms containers are running via WSL2’s real kernel, not a separate isolated environment.

Step 8: use Docker Compose the same way you would on native Linux

docker compose up

Once the WSL2 backend integration is working, Docker Compose and the full Docker CLI toolchain behave identically to a native Linux Docker installation — no WSL-specific command variations needed for everyday use.

Step 9: keep project files on the Linux-native filesystem for best performance

Following the general filesystem-performance guidance, keep Docker projects with bind-mounted volumes on WSL’s native filesystem rather than under /mnt/c — container builds and bind-mounted volume access both benefit meaningfully from avoiding the cross-filesystem overhead.

Why the WSL2 backend is a genuine improvement over the older Hyper-V backend

Docker Desktop’s older Hyper-V-based backend ran containers inside a separate, dedicated VM with its own resource allocation, disconnected from your regular WSL2 environment — the WSL2 backend instead shares the same underlying kernel and resource pool your regular WSL distros already use, meaning containers integrate more efficiently with files and tools already living inside your WSL environment, rather than requiring a separate, disconnected virtualization layer just for Docker specifically.