5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Windows上のwslでdocker compose upを実行するとThe command 'docker' could not be found in this WSL 2 distroと出る[docker desktopをWSLと統合する方法]

Posted at

windowsのwsl上でdocker compose upを実行するとこのような結果になりませんか?

windowsusername:~/test$ docker compose up

The command 'docker' could not be found in this WSL 2 distro.
We recommend to activate the WSL integration in Docker Desktop settings.

For details about using Docker Desktop with WSL 2, visit:

https://docs.docker.com/go/wsl2/

これはたいてい2パターンの原因が考えられます.本記事ではwindows上にインストールされたdocker desktopをWSLと統合する方法について紹介します.

docker compose upが実行できない理由

  • Windows側でDocker Desktopが起動していない
  • Docker Desktopの設定でWSL integrationが有効化されていない
  • 以前のDocker EngineやCLIのインストールとの競合の可能性
  • WSLのバージョンが1.1.3.0未満の可能性
  • Docker Desktopが正しくインストールされていない可能性

と色々原因は考えられるが今回は太字の部分のみ解説します.

そのほかはDocker Desktopを再起動したり,バージョンアップや再インストールすればいいので...

Docker Desktopの設定でWSL integrationが有効化されていない

結論GUI操作のみでいけます.数クリックするのみです.
スクリーンショット 2024-12-20 16.29.06.png
右上の歯車(setting)→Resources→ WSL Integretion →対象のWSLディストリビューションのトグルボタンをOnにする → Docker Desktopを再起動

これでこのように立ち上がります.よかったですね〜
スクリーンショット 2024-12-21 12.50.33.png

それではQiitaアドカレ.24企画の今日のクリスマスツリーです.

詳しくはこちらの記事から

Wondershare Uniconverter 15_000001.GIF

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?