Skip to content

feat(docker): honor PUID/PGID for Unraid nobody:users ownership - #256

Merged
thcp merged 1 commit into
mainfrom
feat/unraid-puid-pgid
Jul 12, 2026
Merged

feat(docker): honor PUID/PGID for Unraid nobody:users ownership#256
thcp merged 1 commit into
mainfrom
feat/unraid-puid-pgid

Conversation

@thcp

@thcp thcp commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

What

Makes the container honor PUID/PGID so files written to mounted appdata are owned by the requested user. On Unraid that's nobody:users (99:100). Addresses discussion #255.

Why

The container hardcoded UID 1001 (gosu app). Setting PUID/PGID did nothing, so appdata files came out owned by 1001 - the exact ownership friction raised in #255.

Changes

  • build/docker-entrypoint.sh: read PUID/PGID (default 1001, so plain docker run is unchanged), chown the writable paths to them, then gosu ${PUID}:${PGID}.
  • templates/stemdeck.xml: add PUID (default 99) and PGID (default 100) variables.

Why only those paths get chowned

Traced every runtime write: registry.json, downloaded audio, and stems all land under /app/jobs; torch/Demucs weights under /cache; best-effort settings in /app/settings.json. App code and the venv under /app stay world-readable, so a non-1001 UID can still import and run them. No Dockerfile change needed - the entrypoint runs as root (no USER directive) and gosu accepts a numeric UID:GID.

Verify

docker build -f build/Dockerfile --build-arg VERSION=0.0.0 -t stemdeck:puid ..
docker run --rm -e PUID=99 -e PGID=100 -v "\$PWD/jobs:/app/jobs" stemdeck:puid \
  sh -c 'id; ls -lan /app/jobs'   # expect uid=99 gid=100, /app/jobs owned 99:100

Unset PUID/PGID -> runs as 1001 (unchanged).

The container hardcoded UID 1001, so files written to mounted appdata were
owned by 1001 rather than Unraid's nobody:users (99:100), causing permission
friction (discussion #255).

The entrypoint now reads PUID/PGID (default 1001, preserving prior behaviour),
chowns the writable paths (/app/jobs, /cache, settings.json) to them, and
drops to that UID:GID via gosu. Expose PUID=99 / PGID=100 as template
variables so Unraid installs get correct ownership out of the box.
@thcp
thcp marked this pull request as ready for review July 12, 2026 20:26
@thcp
thcp merged commit df94005 into main Jul 12, 2026
8 checks passed
@thcp
thcp deleted the feat/unraid-puid-pgid branch July 12, 2026 20:26
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