The docker command is missing inside your WSL Ubuntu
The command 'docker' could not be found in this WSL 2 distro.Short answer
Docker Desktop only adds the docker command to a WSL distro when integration is enabled for that distro. Check that the distro runs WSL 2, that Docker is in Linux containers mode, and that your distro is ticked under Settings, Resources, WSL integration. After changing it, run wsl --shutdown and open the distro again.
Fix it fast
1Find out which cause you have
Run this in PowerShell on Windows, not inside Ubuntu. It shows which distros exist and which WSL version each one uses.
wsl.exe -l -v2Match what you see, then jump to its fix
- 1
The VERSION column of wsl -l -v shows 1 for your UbuntuThe distro runs WSL 1Fix - 2
docker works in PowerShell but not in the Ubuntu shellWSL integration is not enabled for this distroFix - 3
The WSL integration page is missing from Settings, ResourcesDocker Desktop is in Windows containers modeFix - 4
Integration is ticked and the distro is WSL 2, but the command is still unknownWSL was already running when Docker Desktop was installedFix
- 1
What does the error look like?
The command 'docker' could not be found in this WSL 2 distro.docker: command not found
Cause 1 of 4
The distro runs WSL 1
1Check
Docker Desktop integration with WSL requires a distro that uses WSL 2. The list command prints the version per distro.
wsl.exe -l -v2Fix
Convert the distro to WSL 2. Microsoft warns the conversion can take a while and can fail on large projects, so back up important files first.
wsl.exe --set-version Ubuntu-24.04 23Verify
The VERSION column now shows 2.
wsl.exe -l -vConfirmed by learn.microsoft.com
Cause 2 of 4
WSL integration is not enabled for this distro
1Check
In Docker Desktop open Settings, Resources, WSL integration. Docker enables integration for the default distro only; every other distro has to be ticked by hand.
wsl.exe --status
wsl.exe -l -v2Fix
Tick your distro under WSL integration and click Apply. To make Ubuntu the default instead, set it as default first.
wsl.exe --set-default Ubuntu-24.043Verify
Open a new Ubuntu shell and ask for the client version.
docker versionConfirmed by docs.docker.com
Cause 3 of 4
Docker Desktop is in Windows containers mode
1Check
Run this in PowerShell. The Docker documentation says that if WSL integrations is not available under Resources, Docker may be in Windows container mode.
docker version --format '{{.Server.Os}}'2Fix
Right-click the Docker icon in the taskbar tray and choose Switch to Linux containers. Then enable integration for your distro as above.
# Docker Desktop tray menu: Switch to Linux containers3Verify
The server OS now reads linux.
docker version --format '{{.Server.Os}}'Confirmed by docs.docker.com
Cause 4 of 4
WSL was already running when Docker Desktop was installed
1Check
The Docker docs say that for the Docker VMM setup, a WSL that was already running at install time must be restarted so the distros pick up the updated Windows PATH. An older Docker Engine installed inside the distro must also be removed before Docker Desktop.
wsl.exe -l -v2Fix
Stop every distro and the WSL virtual machine, then open Ubuntu again.
wsl.exe --shutdown3Verify
The docker command now resolves.
command -v docker && docker versionConfirmed by docs.docker.com
How do I stop it coming back?
- Keep WSL up to date with wsl.exe --update; Docker Desktop lists a minimum WSL version.
- Do not install Docker Engine inside the distro when you use Docker Desktop; the Docker docs ask you to uninstall it first.
- After installing a new distro, open Docker Desktop settings and tick it.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Servers
Apache logs SIGWINCH and exits on its own
the httpd container stops although nothing crashed
SIGWINCH is Apache's graceful-stop signal.
2 causes, each with a fixServers
sam local fails: Running AWS SAM projects locally requires Docker
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
sam local start-api and sam local invoke run your function inside a Docker container, so SAM stops if it cannot talk to Docker.
3 causes, each with a fixServers
dnf fails to download repo metadata in a CentOS 8 Docker build
The same Dockerfile built fine before 2022
CentOS Linux 8 reached end of life on 31 December 2021 and its content left the mirrors.
2 causes, each with a fixServers
pip install confluent-kafka fails because librdkafka/rdkafka.h is missing
pip stops while building confluent-kafka from source
The error means pip is compiling confluent-kafka from source, and the compiler cannot find the librdkafka C headers.
3 causes, each with a fixServers
Cypress says the npm package is installed but the binary is missing
Cypress binary is missing after npm install in CI or in a Docker build
The npm package is only a launcher.
3 causes, each with a fixServers
A dev container port does not open in the browser when Docker runs on a remote host
If your application only accepts calls from localhost, it will reject connections from published ports
Three things usually break it: the app listens only on localhost inside the container, so published ports are rejected; you open the container port instead of the mapped localhost port VS Code shows; or you changed appPort or a Compose ports list and did not rebuild.
3 causes, each with a fix