Docker image fails when run as a non-root user #1

Closed
opened 2026-09-07 22:33:39 +00:00 by brennoflavio · 0 comments
Owner

The Tokai image cannot start under a non-root Kubernetes security context.

uv run --no-sync initializes its cache at /.cache/uv, but the image filesystem is root-owned. When the container runs as a non-root user, startup fails:

  error: Failed to initialize cache at `/.cache/uv`
    Caused by: failed to create directory `/.cache/uv`: Permission denied (os error 13)

This prevents deployments using a restricted/non-root pod security policy unless an extra writable volume is mounted at /.cache.

Expected behavior

The image should support running as an arbitrary non-root user without requiring a root-owned filesystem path to be writable.

Suggested fix

Configure uv’s cache to use a universally writable location such as /tmp/uv-cache, or create and use a non-root user with a writable home/cache directory in the Docker image.

The Tokai image cannot start under a non-root Kubernetes security context. uv run --no-sync initializes its cache at /.cache/uv, but the image filesystem is root-owned. When the container runs as a non-root user, startup fails: ```text error: Failed to initialize cache at `/.cache/uv` Caused by: failed to create directory `/.cache/uv`: Permission denied (os error 13) ``` This prevents deployments using a restricted/non-root pod security policy unless an extra writable volume is mounted at /.cache. Expected behavior The image should support running as an arbitrary non-root user without requiring a root-owned filesystem path to be writable. Suggested fix Configure uv’s cache to use a universally writable location such as /tmp/uv-cache, or create and use a non-root user with a writable home/cache directory in the Docker image.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
brennoflavio/tokai#1
No description provided.