0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

vscode/devcontainerでレポジトリルートまで遡り自動mountされる動作を回避する

Posted at

VSCode 1.102.0 / devcontainer で発生することを確認した.
devcontainer内でgitコマンドを容易に使えるようにするための親切挙動ではあるのだが, 私は困ったので回避方法を書き残しておく.

結論

devcontainer.json で下記のように workspaceMount を明示すれば回避できる.

{
  "workspaceMount": "source=${localWorkspaceFolder},target=${containerWorkspaceFolder},type=bind,consistency=cached",
  "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}"
}

参考文献

If you add the image or dockerFile properties to devcontainer.json, VS Code will automatically "bind" mount your current workspace folder into the container. If git is present on the host's PATH and the folder containing .devcontainer/devcontainer.json is within a git repository, the current workspace mounted will be the root of the repository.
If git is not present on the host's PATH, the current workspace mounted will be the folder containing .devcontainer/devcontainer.json.

0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?