The command "docker" could not be found in this WSL 2 distro
Fixes 'The command docker could not be found in this WSL 2 distro' when Docker Desktop's WSL integration is off for that distro. Use when docker works in one WSL distro or PowerShell but not another. Not for Linux-native installs.
TL;DR: Enable WSL integration for that distro: Docker Desktop > Settings > Resources > WSL Integration > toggle your distro on > Apply & Restart. The docker CLI inside WSL comes from Desktop's integration, not from a Linux install; a distro without the toggle has no docker binary at all.
The error
The command 'docker' could not be found in this WSL 2 distro. We recommend to activate the WSL integration in Docker Desktop settings.Fix it
- Open Docker Desktop Settings > Resources > WSL Integration.
- Toggle ON the distro where you want docker.
- Apply & Restart.
- In the distro, verify:
docker ps Expected: works.
When this applies
- Multiple WSL distros, docker missing in some
- After installing a new distro
When this does NOT apply
- Native Linux (install docker properly there)
- "Cannot connect to the Docker daemon" inside WSL (integration on but Desktop not running)
Versions
Docker Desktop 4.x with WSL2 backend.
Why it happens
Desktop injects the CLI and credentials into each enabled distro via its integration. Distros not toggled get nothing, hence 'command not found' rather than a connection error.
Edge cases
- Do NOT
apt install docker-ceinside the WSL distro alongside Desktop integration; the two daemons fight over the socket. - 'Enable integration with my default WSL distro' covers only the default; extra distros need individual toggles.
- After Windows updates, integration sometimes silently disables; re-toggle fixes it.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.