Support running container as non-root user#60
Merged
Conversation
Create a tracefinity user (UID 1000) that runs by default. The container also works with arbitrary UIDs via --user "$(id -u):$(id -g)" so mounted volume files are owned by the host user instead of root. Changes: - Add docker-entrypoint.sh for runtime directory creation - Create non-root tracefinity user, default to it via USER - Move nginx pid to /tmp/nginx, remove user directive - Move supervisord pid/logs to /tmp/supervisor - Set U2NET_HOME=/app/.u2net so rembg model cache is writable - Set HOME=/app so ~ resolves to a writable path - chmod 777 all runtime-writable directories for arbitrary UID support - Update README with --user example - Document non-root setup in docs/gotchas.md Signed-off-by: Jason Madigan <[email protected]>
Signed-off-by: Jason Madigan <[email protected]>
jasonmadigan
marked this pull request as ready for review
June 3, 2026 15:46
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.
Summary
Makes the Docker container work with
--user "$(id -u):$(id -g)"so mounted volume files are owned by the host user instead of root.Closes #50
Changes
tracefinityuser (UID 1000) as default non-root user/tmp/(writable without root)user www-datadirective from nginx configdocker-entrypoint.shthat creates required runtime directories at startupU2NET_HOME=/app/.u2netandHOME=/appfor model downloadsHow it works
tracefinity(UID 1000) — no--userneeded--user: works with any UID because runtime dirs are world-writable (standard pattern for arbitrary UID containers, same as OpenShift S2I images)docker runcommands without--userstill workTest plan
uid=1000(tracefinity)--user 501works, all runtime dirs writable