-
Notifications
You must be signed in to change notification settings - Fork 396
Description
When a remoteUser is specified, I don't believe this is presently a way currently to use volume mounts that mount outside /home/vscode due to the ensuing permission issues.
This is frustrating because for Python packaging for example, it's important the container have its own volume for .venv instead of re-using the hosts' .venv, which might contain binary extensions compiled for the different OS.
Information
- VSCode Version: 1.89.1
- Local OS Version: MacOS 14.5 (23F79)
- Remote OS Version: Debian Bookworm
- Remote Extension/Connection Type: devcontainers
Steps to Reproduce
-
Setup a basic rootless devcontainer.json (in this case remoteUser is
vscode):{ "name": "My Devcontainer", "image": "mcr.microsoft.com/devcontainers/base:bookworm", // Rename the mount to /workspace "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind", "workspaceFolder": "/workspace", "containerEnv": { "PDM_PYTHON": "/workspace/.venv/bin/python" }, "mounts": [ // Put Python VENV data in a volume so it doesn't conflict with local setup { "type": "volume", "source": "${devcontainerId}-venv", "target": "/workspace/.venv" } ], // Features to add to the dev container. More info: https://containers.dev/features. "features": { "ghcr.io/devcontainers/features/python:1": { "version": "3.11" }, "ghcr.io/devcontainers-contrib/features/pdm:2": {}, } } -
Try to mount a volume and use it
Expected results
Volume permissions are automatically adjusted to match the configured remoteUser, or a root-user entrypoint is available so that the permissions can be adjusted.
Actual results
Volume is mounted using the parent folder permissions (in this case, root:root). All lifecycle script hooks (e.g. postCreateCommand) are run under remoteUser and therefore the volume mount cannot be used and its permissions cannot be changed without removing rootless.
Does this issue occur when you try this locally?: N/A
Does this issue occur when you try this locally and all extensions are disabled?: Yes