Movatterモバイル変換


[0]ホーム

URL:


TryMCP servers to extend agent mode in VS Code!

Dismiss this update

Change the default source code mount

If you add theimage ordockerFile properties todevcontainer.json, VS Code will automatically "bind" mount your current workspace folder into the container. Ifgit is present on the host'sPATH and the folder containing.devcontainer/devcontainer.json is within agit repository, the current workspace mounted will be the root of the repository. Ifgit is not present on the host'sPATH, the current workspace mounted will be the folder containing.devcontainer/devcontainer.json.

While this is convenient, you may want to changemount settings, alter the type of mount, location, orrun in a remote dev container.

You can use theworkspaceMount property indevcontainer.json to change the automatic mounting behavior. It expects the same value as theDocker CLI--mount flag.

For example:

"workspaceMount":"source=${localWorkspaceFolder}/sub-folder,target=/workspace,type=bind","workspaceFolder":"/workspace"

This also allows you to do something like a named volume mount instead of a bind mount, which can be useful particularly whenusing a remote Docker Host or youwant to store your entire source tree in a volume.

If you've already built the container and connected to it, runDev Containers: Rebuild Container from the Command Palette (F1) to pick up the change. Otherwise runDev Containers: Open Folder in Container... to connect to the container.

Video : Work with Monorepos in a dev container by changing default mount



Video : Change the default location of your project in a container

07/09/2025

[8]ページ先頭

©2009-2025 Movatter.jp