docker, windows
Docker Desktop で WSL2 の設定しているのに The command 'docker' could not be found in this WSL 2 distro が出る
WSL2 の Ubuntu にて、
1$ docker build (git)-[main]
2
3The command 'docker' could not be found in this WSL 2 distro.
4We recommend to activate the WSL integration in Docker Desktop settings.
5
6For details about using Docker Desktop with WSL 2, visit:
7
8https://docs.docker.com/go/wsl2/
が出ている。もちろん、Docker Desktop WSL 2 backend on Windows | Docker Docs は実施している。
コマンドプロンプトにて、wsl コマンドを実行する。
1C:\Users\am>wsl.exe -l -v
2 NAME STATE VERSION
3* Ubuntu Running 2
4 docker-desktop Stopped 2
5 docker-desktop-data Stopped 2
Stopped とはなんだ? と思ったが、これもしかして、Docker Desktop でも WSL2 の VM 起動しているのかな?
1# docker desktop 起動後
2
3C:\Users\am>wsl.exe -l -v
4 NAME STATE VERSION
5* Ubuntu Running 2
6 docker-desktop Running 2
7 docker-desktop-data Running 2
Running になった。WSL2 で docker コマンドを実行する。
1$ docker images (git)-[main]
2REPOSITORY TAG IMAGE ID CREATED SIZE
3hubproxy.docker.internal:5555/docker/desktop-kubernetes kubernetes-v1.28.2-cni-v1.3.0-critools-v1.28.0-cri-dockerd-v0.3.4-1-debian 1d7e8203bdb9 3 weeks ago 430MB
まあ、当たり前ですよね。
まとめると、
- Docker Desktop を起動しないと WSL2 の docker-desktop VM が起動していない
- 結果として、docker コマンドは実行できるが、
The command 'docker' could not be found in this WSL 2 distroというエラーが出る?