Run container as non-root user (UID/GID 1000) for rootless compatibility#799
Open
dmfrey wants to merge 1 commit intomadeofpendletonwool:mainfrom
Open
Run container as non-root user (UID/GID 1000) for rootless compatibility#799dmfrey wants to merge 1 commit intomadeofpendletonwool:mainfrom
dmfrey wants to merge 1 commit intomadeofpendletonwool:mainfrom
Conversation
Adds a dedicated pinepods user (UID 1000, GID 1000) to the image and switches to it before the entrypoint, following Docker and OWASP best practices for non-root containers: - dockerfile: create pinepods user/group, pre-create and chown all runtime directories at build time, copy Horust service configs at build time (avoids runtime root write), add USER directive, drop the old EXPOSE 8080/8000 in favour of the correct 8040 - startup/nginx.conf: add pid /tmp/nginx.pid and redirect all nginx temp paths to /tmp/nginx so nginx runs without root - startup/startup.sh: replace /etc/localtime writes with TZ env var (musl/glibc respect it without touching root-owned files), remove runtime chown of volume dirs, remove exim root setup, remove runtime Horust services copy (now done at build time) - docker-compose (postgres/mysql/mariadb): add user: "1000:1000", cap_drop: [ALL], security_opt: no-new-privileges, remove PUID/PGID env vars, remove /etc/localtime volume mounts; add note that host volume dirs must be pre-owned by UID 1000 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Adds full rootless container support by running the PinePods container as a dedicated non-root user (
pinepods, UID/GID 1000), following Docker, OWASP, and rootlesscontaine.rs best practices. This is a common requirement in homelab and enterprise environments.Changes
dockerfilepinepodssystem user/group with fixed UID/GID 1000pinepods:pinepods(downloads, backups, certs, cache, logs, nginx dirs, horust services)/etc/horust/services/at build time, eliminating the runtime root writeUSER pinepods:pinepodsbeforeENTRYPOINTEXPOSEfrom8080 8000to8040startup/nginx.confpid /tmp/nginx.pidso nginx can write its PID without root/tmp/nginxstartup/startup.sh/etc/localtime//etc/timezonewith reliance on theTZenvironment variable (musl/glibc honour it without touching root-owned files)chown -R $PUID:$PGIDof volume directories (non-root can't chown; host dirs must be pre-owned — see note below).tomlconfigs (now done at build time)docker-compose(postgres / mysql / mariadb)user: "1000:1000"cap_drop: [ALL]security_opt: no-new-privileges:truePUID/PGIDenvironment variables/etc/localtimeand/etc/timezonevolume mountsMigration note for existing deployments
Before (re)starting the container, ensure your host volume directories are owned by UID 1000:
Test plan
docker exec ... idconfirms the process runs as UID 1000🤖 Generated with Claude Code