Skip to content

Does it work with bind mounts? #2

Closed

Activity

  1. added
    question
    on Jun 27, 2023
  2. self-assigned this
    on Jun 27, 2023
  3. benz0li commented on Jun 27, 2023

    @benz0li
    MemberAuthor

    Yes.

    By default, mount type volume is used, so Dev Containers behave the same as Codespaces.

    When working with Docker Desktop, volumes are more performant than bind mounts.

  4. benz0li commented on Jun 27, 2023

    @benz0li
    MemberAuthor

    To work with a bind mount, e.g. modify the devcontainer.json for Python base as follows:

    diff --git a/.devcontainer/python-base/devcontainer.json b/.devcontainer/python-base/devcontainer.json
    index b31e40c..dae65cc 100644
    --- a/.devcontainer/python-base/devcontainer.json
    +++ b/.devcontainer/python-base/devcontainer.json
    @@ -77,8 +77,8 @@
     
     	// Set 'remoteUser' to 'root' to connect as root instead.
     	"remoteUser": "vscode",
    -	"workspaceMount": "source=python-base-home-vscode,target=/home/vscode,type=volume",
    -	// "workspaceMount": "source=${localWorkspaceFolder}/.bind-mounts/python-base-home-vscode,target=/home/vscode,type=bind",
    +	// "workspaceMount": "source=python-base-home-vscode,target=/home/vscode,type=volume",
    +	"workspaceMount": "source=${localWorkspaceFolder}/.bind-mounts/python-base-home-vscode,target=/home/vscode,type=bind",
     	"workspaceFolder": "/home/vscode"
     
     	// "remoteUser": "root",

    ℹ️ This will mount <root-of-this-repository>/.bind-mounts/python-base-home-vscode to /home/vscode in the Dev Container.

  5. pinned this issue on Jul 12, 2023
  6. locked and limited conversation to collaborators on Jul 13, 2023
  7. converted this issue into a discussionon Jun 16, 2024
  8. unpinned this issue on Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

question

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions