Skip to content

Does it work with bind mounts? #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
benz0li opened this issue Jun 27, 2023 · 2 comments
Closed

Does it work with bind mounts? #2

benz0li opened this issue Jun 27, 2023 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@benz0li
Copy link
Member

benz0li commented Jun 27, 2023

Docker: https://docs.docker.com/storage/bind-mounts/
Podman: https://docs.podman.io/en/latest/markdown/podman-run.1.html#mount-type-type-type-specific-option

@benz0li benz0li added the question Further information is requested label Jun 27, 2023
@benz0li benz0li self-assigned this Jun 27, 2023
@benz0li
Copy link
Member Author

benz0li commented Jun 27, 2023

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.

@benz0li
Copy link
Member Author

benz0li commented Jun 27, 2023

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.

@benz0li benz0li closed this as completed Jun 27, 2023
@benz0li benz0li pinned this issue Jul 12, 2023
@b-data b-data locked and limited conversation to collaborators Jul 13, 2023
@benz0li benz0li converted this issue into a discussion Jun 16, 2024
@benz0li benz0li unpinned this issue Jun 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant