WSL With Docker Could Not Be Found

Problem

1
2
3
4
5
6
$ docker

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.

Solution

Run in cmd.exe

1
2
3
> wsl --list --verbose
  NAME             STATE           VERSION
  Ubuntu           Running         1

Then to switch it with wsl --set-version <your proc> 21

1
2
3
4
> wsl --set-version Ubuntu 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.

Also you need to go to the docker desktop settings, and enable integration with your distro in “Resources -> WSL Integration”.

Reference

Licensed under CC BY-NC-SA 4.0
最后更新于 2021-09-24 14:21 +0800
使用 Hugo 构建
主题 StackJimmy 设计