-
Notifications
You must be signed in to change notification settings - Fork 199
Run containers as non-root user with Docker --user support #127
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
Open
brycelelbach
wants to merge
12
commits into
main
Choose a base branch
from
non-root
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
…tup and cleanup functions, replacing them with environment variable exports for user ID and group ID. Adjust Docker Compose files to set user permissions dynamically based on host user. Introduce user-setup script for runtime environment configuration.
…up.bash since it's sourced via BASH_ENV and affects all subsequent scripts. Use safe parameter expansion in jupyter-start.bash. Configure nsight service to start as root but switch to HOST_UID via USER environment variable. Add USER to common-service environment block for all containers.
…p.bash to user-env.bash and dev-mount.bash to dev-common.bash. Add shell-start.bash for interactive shell sessions.
Contributor
❌ Link Check FailedBroken links were detected in this PR. Please check the workflow run logs for details on which links are broken. Common fixes:
To test links locally:./brev/test-links.bash . |
…specific scripts.
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.
Summary
This PR simplifies the development mount setup by removing bindfs and using Docker's native
--userflag to match host user permissions on bind mounts.Changes
New approach
achuser (UID 1000) by defaultHOST_UID/HOST_GIDenvironment variables are set, containers run as that user insteadALL ALL=(ALL) NOPASSWD:ALL)Files modified
New file:
brev/user-setup.bash- Runtime user environment setup (HOME, Jupyter config, IPython config, Git safe directory)Simplified:
brev/dev-mount.bash- Removed bindfs, now just exports HOST_UID/HOST_GIDbrev/dev-start.bash- Removed bindfs mount referencesbrev/dev-stop.bash- Removed bindfs unmount logicbrev/dev-test.bash- Removed cleanup trap and bindfs referencesUpdated startup scripts:
brev/jupyter-start.bash- Removed explicit user-setup sourcing (now automatic)brev/base-start.bash- Removed explicit user-setup sourcing (now automatic)brev/nsight-start.bash- Uses sudo for privileged operationsUpdated Dockerfiles (all 5 tutorials):
achuser with UID 1000BASH_ENVfor non-interactive shell initialization/etc/profile.d/and/etc/bash.bashrcachUpdated docker-compose.yml (all 5 tutorials):
user: roottouser: "${HOST_UID:-1000}:${HOST_GID:-1000}"Documentation:
CONTRIBUTING.md- Removed bindfs referencesBenefits