Skip to content

Fix docker container crashing when run with non-1000 user - #569

Open
na-ji wants to merge 1 commit into
maxdorninger:masterfrom
na-ji:fix/566-non-root-uid-uv-cache
Open

Fix docker container crashing when run with non-1000 user#569
na-ji wants to merge 1 commit into
maxdorninger:masterfrom
na-ji:fix/566-non-root-uid-uv-cache

Conversation

@na-ji

@na-ji na-ji commented Aug 10, 2026

Copy link
Copy Markdown

Summary

  • UV_CACHE_DIR was hardcoded to /home/mediamanager/.cache/uv, owned by uid 1000. Running the container as any other non-root uid (e.g. user: "1001:1001" in docker-compose) caused uv to crash on startup with a permission error, since it couldn't create the cache dir.
  • Switched UV_CACHE_DIR to /tmp/uv-cache in both Dockerfile and metadata_relay/Dockerfile. /tmp is world-writable via the sticky bit, so this works for any uid/gid without needing ownership changes.

Fixes #566

Test plan

  • Built the dependencies stage from the pre-fix Dockerfile and reproduced the exact error from the issue running as uid 1001 and uid 99.
  • Built the dependencies stage from the fixed Dockerfile and confirmed uv run works as uid 1001, uid 99, uid 1000 (default), and root.

Summary by CodeRabbit

  • Chores
    • Updated the application’s container build configuration to use a temporary location for package-manager caching.
    • Preserved cache ownership settings to maintain consistent build behaviour.

UV_CACHE_DIR was hardcoded to /home/mediamanager/.cache/uv, owned by
uid 1000. Running the container as any other non-root uid (e.g. via
docker-compose `user:`) caused uv to fail with a permission error on
startup, since it couldn't create the cache dir.

Switched to /tmp/uv-cache, which is world-writable via the sticky bit
regardless of uid/gid.

Fixes maxdorninger#566
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The Dockerfiles move the uv cache from the mediamanager home directory to /tmp/uv-cache. The main Dockerfile retains UID/GID 1000 ownership for its BuildKit cache mount. Other build settings remain unchanged.

Changes

Container cache configuration

Layer / File(s) Summary
Relocate uv cache paths
Dockerfile, metadata_relay/Dockerfile
Both Dockerfiles use /tmp/uv-cache for the uv cache and BuildKit cache mount. The main Dockerfile retains UID/GID 1000 ownership settings. Other build steps remain unchanged.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Poem

A rabbit hops through /tmp with care,
Finding fresh cache space there.
The builds stay neat, the paths align,
With fewer home-directory binds.
Squeak, the containers start on time!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes address issue #566 by moving the uv cache to a location usable by arbitrary non-root UIDs and GIDs.
Out of Scope Changes check ✅ Passed Both Dockerfile changes directly support the linked issue and PR objective; no unrelated changes are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the Docker container fix and is directly related to the changes, although it exceeds the ideal 50-character length.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@na-ji na-ji changed the title fix: use uid-independent uv cache dir for non-1000 non-root containers Fix container crashing when run with non-1000 user Aug 10, 2026
@na-ji na-ji changed the title Fix container crashing when run with non-1000 user Fix docker container crashing when run with non-1000 user Aug 10, 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.

[BUG] Running docker container as non root/non-1000 crashes on startup

1 participant