Skip to content

devcontainer: run as non-root user to fix file ownership#3096

Merged
snormore merged 1 commit intomainfrom
snor/devcontainer-non-root-user
Feb 25, 2026
Merged

devcontainer: run as non-root user to fix file ownership#3096
snormore merged 1 commit intomainfrom
snor/devcontainer-non-root-user

Conversation

@snormore
Copy link
Contributor

@snormore snormore commented Feb 24, 2026

Summary

  • Switch remoteUser from root to vscode so files created inside the container are owned by the host user instead of root, fixing permission issues on Windows/WSL
  • Add updateRemoteUserUID to remap container UID to match the host user
  • Use postStartCommand to chmod the docker socket and fix ~/.docker ownership on every container start
  • Take ownership of the volume-mounted target/ directory in postCreateCommand

Testing Verification

  • docker ps works without sudo from VS Code terminal
  • Files created inside the container are owned by the host user
  • Rust and Go toolchains function correctly under the vscode user

@snormore snormore force-pushed the snor/devcontainer-non-root-user branch from bfdcf04 to b85ef2d Compare February 24, 2026 21:52
@snormore snormore marked this pull request as ready for review February 24, 2026 21:53
Switch remoteUser from root to vscode so files created inside the
container are owned by the host user instead of root. Use
postStartCommand to chmod the docker socket and fix ~/.docker
ownership on every container start.
@snormore snormore force-pushed the snor/devcontainer-non-root-user branch from 0a1211c to 8bae8dc Compare February 24, 2026 21:55
Copy link
Contributor

@juan-malbeclabs juan-malbeclabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Very grateful!

@snormore snormore merged commit dbe8707 into main Feb 25, 2026
30 checks passed
@snormore snormore deleted the snor/devcontainer-non-root-user branch February 25, 2026 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants