Skip to content

Sync vscode uid/gid and add devcontainer CLI instructions - #150

Closed
bnmajor wants to merge 1 commit into
mainfrom
permissions-issues
Closed

Sync vscode uid/gid and add devcontainer CLI instructions#150
bnmajor wants to merge 1 commit into
mainfrom
permissions-issues

Conversation

@bnmajor

@bnmajor bnmajor commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Running the django/celery containers with plain docker compose up executes everything as the image's fixed vscode uid/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, requiring sudo to clean up later.

VS Code and the Dev Containers CLI don't have this problem - they already handle uid/gid remapping themselves.

  • Add dev/docker-entrypoint.sh
    • updates the vscode user/group to match NM_USER=<uid>:<gid>
    • chown -Rs /home/vscode
    • drops privileges to run the requested command as vscode via gosu
  • set the new script as ENTRYPOINT so it can adjust uid/gid before dropping privileges
  • pass NM_USER through to the django and celery services
  • update README to document the ownership caveat and the three supported ways to run the app: plain docker compose with NM_USER, VS Code Dev Containers, and the Dev Containers CLI

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.
@bnmajor

bnmajor commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator Author

Closing in favor of #153

@bnmajor bnmajor closed this Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant