The command $ docker
could not be found in this WSL 1 distro.
We recommend to convert this distro to WSL 2 and activate
the WSL integration in Docker Desktop settings.
See https://docs.docker.com/docker-for-windows/wsl/ for details.
Not able to change to WSL2 and not able to install docker:
However, since WSL 2 now runs on a Linux kernel with full system call capacity, Docker can fully run in WSL 2. This means that Linux containers can run natively without emulation, resulting in better performance and interoperability between your Windows and Linux tools.
You need to go to the docker desktop settings, and enable integration with your distro in "Resources -> WSL Integration".
Assuming you already have wsl 2 in your system, run powershell as admin:
run wsl --list --verbose
which will give you a list of your wsl running processes:
> wsl --list --verbose
NAME STATE VERSION
Ubuntu-20.04 Running 1
Then to switch it with wsl --set-version <your proc> 2
:
> wsl --set-version Ubuntu-20.04 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Conversion complete.
I stuck with this error after remove Ubuntu 18.04 and install the 20.04.
Even with the WSL 2 enabled, I still face this error.
This is what works for me, go the Settings --> resource and toggle the "Ubuntu" then the error disappear :)
My problem seems like it's the same, despite the integration WSL is already enabled since installation.
In the windows shell:
> wsl docker --version
The command 'docker' could not be found in this WSL 2 distro.
We recommend to activate the WSL integration in Docker Desktop settings.
See https://docs.docker.com/docker-for-windows/wsl/ for details.
An option to resolve this problem is reinstalling Docker Desktop (https://learn.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/configure-docker-daemon#how-to-uninstall-docker), but don't need to do this.
The steps below work for me (I found at https://github.com/docker/for-win/issues/7039).
Open windows shell (maybe as admin), and run:
> wsl -t docker-desktop
> wsl --shutdown
> wsl --unregister docker-desktop
Then go to windows services, stop the Docker Desktop Service, OR to do this running the command in windows shell as admin:
> Stop-Service -Name "com.docker.service"
And finally, restart the Docker Desktop App.
Test in the windows shell:
> wsl docker --version
Docker version 20.10.2, build 2291f61
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With