Sync vscode uid/gid and add devcontainer CLI instructions - #150
Closed
bnmajor wants to merge 1 commit into
Closed
Conversation
Running the django/celery containers with plain `docker compose up` previously ran everything as the image's fixed vscode uid/gid (1000:1000), so files created in bind mounts ended up owned by that uid/gid instead of the host user. Add dev/docker-entrypoint.sh: when NM_USER=<uid>:<gid> is set, it updates the vscode user/group to match, chowns /home/vscode, then drops privileges to run the requested command as vscode via gosu. Without NM_USER, behavior is unchanged.
Collaborator
Author
|
Closing in favor of #153 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Running the django/celery containers with plain
docker compose upexecutes everything as the image's fixedvscodeuid/gid (1000:1000). If the host user has a different uid/gid, files created in bind mounts end up owned by 1000:1000 instead of the host user, requiringsudoto clean up later.VS Code and the Dev Containers CLI don't have this problem - they already handle uid/gid remapping themselves.
dev/docker-entrypoint.shvscodeuser/group to matchNM_USER=<uid>:<gid>chown -Rs/home/vscodevscodeviagosuENTRYPOINTso it can adjust uid/gid before dropping privilegesNM_USERthrough to thedjangoandceleryservicesREADMEto document the ownership caveat and the three supported ways to run the app: plaindocker composewithNM_USER, VS Code Dev Containers, and the Dev Containers CLI