Home›VS Code / Dev Env›Windowsで devcontainer を使うときの settings.json 整理(Docker / Podman / WSL)
Windowsで devcontainer を使うときの settings.json 整理(Docker / Podman / WSL)

Windowsで devcontainer を使うときの settings.json 整理(Docker / Podman / WSL)Organizing settings.json for Dev Containers on Windows (Docker / Podman / WSL)

元記事を読むRead original articleqiita.com(新しいタブで開きます)(opens in a new tab)
AI2 点サマリ2 key points
  • VS Code Dev Containersでは、Windows上のDocker、Podman、WSLという3構成別にsettings.jsonの要否が分かります。
  • Dockerは追加指定が不要で、Podmanは実行先を替え、WSLはWindows側の指定を省けるため、構成に合う設定を選べます。
  • VS Code Dev Containers settings vary across three Windows setups: Docker, Podman, and WSL.
  • It identifies Podman command overrides and when developers can skip host configuration.

本ページの本文と要約は AI による自動生成です。日本語版と英語版は言語ごとに独立して生成されるため、表現や詳しさが異なる場合があります。正確性は元記事 (qiita.com) をご確認ください。The body and summaries are AI-generated independently for each language, so wording and detail may differ. Verify accuracy at the original source (qiita.com).

要約と収集メタデータに基づく AI 解説。元記事全文の転載・翻訳ではありません。AI explainer based on the summaries and collected metadata, not a copy or translation of the full source article.

WindowsでVS CodeのDev Containersを使う場合、コンテナランタイムの置き場所によってsettings.jsonの内容が変わります。Windows上のDocker、Podman、WSLという3つの構成を区別し、それぞれに必要な指定を整理します。

設定の前提

Dev Containersを利用する前提として、拡張機能「ms-vscode-remote.remote-containers」を導入します。設定の要否は、dockerコマンドをWindows側で実行するのか、別の実行ファイルへ差し替えるのか、WSL側で実行するのかによって分かれます。

Docker

DockerをWindowsにインストールし、Docker Desktopを利用している場合は、dockerがPATHに通っているため追加設定は不要です。dockerPathを明示する場合の設定は「"dev.containers.dockerPath": "docker"」です。Windows側でdockerコマンドをそのまま呼び出せる構成となります。

Podman

PodmanをWindowsにインストールしている場合は、Dev Containersが呼び出すdockerコマンドの実行先をPodmanへ差し替えます。dockerPathには「podman」を指定し、dockerComposePathには「podman-compose」を指定します。つまり、「"dev.containers.dockerPath": "podman"」と「"dev.containers.dockerComposePath": "podman-compose"」をsettings.jsonに記述します。

WSL

VS CodeのWSL拡張でWSLへ接続し、その中でフォルダを開く構成では、Dev Containers拡張もWSL側で動作します。このため、WSL内のdockerをそのまま利用でき、Windows側の設定は不要です。指定が必要な場合はRemote [WSL]の設定に「"dev.containers.dockerPath": "docker"」を記述します。プロジェクトは「~/work/...」のようなWSLのファイルシステムへ置きます。「/mnt/c/...」は遅いとされています。

Docker on Windows

VS Code Dev Containers settings on Windows depend on where the container runtime is installed. The relevant settings.json entries differ among Docker, Podman, and WSL, so the configuration should match the runtime’s location.

The ms-vscode-remote.remote-containers extension, identified as Dev Containers, must be installed first. When Docker Desktop is installed on Windows, the docker command is already available through PATH. No additional setting is required.

The corresponding value, if specified, is:

"dev.containers.dockerPath": "docker"

This configuration tells Dev Containers to use the docker executable available on Windows, but the extra declaration can be omitted when Docker Desktop has already placed the command on PATH.

Podman command overrides

When Podman is installed on Windows, Dev Containers still calls Docker commands. The executable paths therefore need to be changed so that those calls use Podman and podman-compose instead.

The required settings are:

"dev.containers.dockerPath": "podman"

"dev.containers.dockerComposePath": "podman-compose"

These entries replace the Docker command targets with the corresponding Podman executables. Unlike the Docker Desktop setup, this Windows configuration requires explicit command overrides in settings.json.

WSL configuration

For the WSL setup, VS Code connects to WSL through the WSL extension and opens the project folder from inside that environment. Because the Dev Containers extension runs on the WSL side, it can use the docker command installed within WSL directly.

No Windows-side Dev Containers setting is required. If an explicit path is needed, it should be placed in the Remote [WSL] settings:

"dev.containers.dockerPath": "docker"

Projects should be stored in the WSL file system, such as ~/work/..., rather than under /mnt/c/.... The latter location is described as slow. This keeps both the project and the runtime-facing Dev Containers configuration within WSL.

ポコとTECHガイドPoko & TECH Guide

ポコと当サイトのTECHガイドが、記事の要約と収集した情報から読みどころを語るAI生成の対話です。Poko and TECH Dashboard's own TECH Guide discuss the article's highlights in an AI-generated conversation based on its summary and collected source details.

  1. ポコPokoWindowsでPodmanを使うと、なんで設定を2つ変えるの?Why do I need to change two settings when using Podman on Windows?
  2. TECHガイドTECH GuideDev Containersがdockerコマンドを呼ぶためだよ。実行先をpodman、Composeをpodman-composeに差し替えるんだ。Dev Containers calls Docker commands. The settings redirect those calls to podman and podman-compose.
  3. ポコPokoじゃあ、Windowsで設定に迷う人が、自分の構成に必要なものだけ選べるってこと?So this helps Windows users pick only the settings their setup actually needs?
  4. TECHガイドTECH Guideそうだね。Docker Desktopは追加設定なしで、WSLならWindows側の指定を省き、必要ならWSL側に書けるよ。Yes. Docker Desktop needs no extra setting, while WSL can skip the Windows-side configuration and use WSL settings if needed.
  5. ポコPokoDockerは追加なし、Podmanは実行先を変更、WSLはWSL側で考える、と分ければいいんだね。Got it: no additions for Docker, redirect commands for Podman, and handle settings inside WSL for the WSL setup.
  6. TECHガイドTECH Guideうん。WSLではプロジェクトを~/work/...に置き、遅いとされる/mnt/c/...は避ける点にも注意だよ。That’s the split. For WSL, keep the project under ~/work/... and avoid /mnt/c/..., which the article notes is slow.
記事情報・収集記録Article details & collection record
出典Source
Qiita VSCodeコミュニティCommunity
公開日時 (JST)Published (JST)
収集日時 (JST)Collected (JST)
配信形式Format
ブログBlog
原文言語Source language
JA
重要度の位置づけImportance in this lane
InfoInformational(VS Code / Dev Env 58件中、同等以上 58件)(58 of 58 VS Code / Dev Env entries are equal or higher)
出典の平均重要度(掲載直近 30 件・最大 30 件)Source average (last 30 listed, up to 30)
1.7 / 31=情報 · 2=中 · 3=高1=Info · 2=Medium · 3=High
情報の寿命Half-life
中期 (チュートリアル)Medium-term (tutorial)

🔷VS Code / Dev Env の他の記事More from VS Code / Dev Envもっと見る →View more →

ページ上部へScroll to top