Skip to content

fix(docker): pre-create /home/deepseek/.deepseek to avoid permission denied on first run#1699

Closed
mvanhorn wants to merge 2 commits into
Hmbown:mainfrom
mvanhorn:fix/1684-docker-volume-permission-deepseek-home
Closed

fix(docker): pre-create /home/deepseek/.deepseek to avoid permission denied on first run#1699
mvanhorn wants to merge 2 commits into
Hmbown:mainfrom
mvanhorn:fix/1684-docker-volume-permission-deepseek-home

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Summary

The non-root deepseek user couldn't write /home/deepseek/.deepseek/tasks/runtime/threads on first run inside Docker, failing with Permission denied (os error 13). The Dockerfile created the user and switched to it before any process ever touched the home subdirectory; the runtime then hit a fresh /home/deepseek owned by root (because the user's HOME was newly created with default perms but bind-mounted volumes adopted root ownership).

Pre-create /home/deepseek/.deepseek with deepseek:deepseek ownership in the same RUN that adds the user, so any subsequent volume mount or process write lands on a directory the runtime user can write to.

Why this matters

Reporter @[issue1684_user] in #1684 reported the bridge crashing on first launch in Docker before any thread could be created. The fix is contained to the user-setup section of the Dockerfile (same RUN that calls useradd), keeps the image layer count unchanged, and doesn't touch the runtime.

Fixes #1684

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Dockerfile to create a .deepseek directory in the user's home directory with appropriate ownership. The review feedback suggests using the install command to more concisely create the directory while simultaneously setting restrictive permissions (0700) to enhance security for sensitive data.

Comment thread Dockerfile Outdated
Comment on lines +77 to +79
&& useradd --create-home --shell /bin/bash --uid 1000 --gid 1000 deepseek \
&& mkdir -p /home/deepseek/.deepseek \
&& chown -R deepseek:deepseek /home/deepseek/.deepseek

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using the install command is a more concise and idiomatic way to create a directory with specific ownership and permissions in a single step within a Dockerfile. Additionally, since the .deepseek directory stores sensitive information such as API keys (as noted in the README), it is a security best practice to restrict its permissions to the owner only (e.g., mode 0700).

    && useradd --create-home --shell /bin/bash --uid 1000 --gid 1000 deepseek \
    && install -d -m 0700 -o deepseek -g deepseek /home/deepseek/.deepseek

@Hmbown Hmbown added this to the v0.8.39 milestone May 15, 2026
Collapse the mkdir + chown pair into a single `install -d` invocation
that sets ownership and 0700 permissions atomically. The .deepseek
directory stores API keys per the README, so restricting access to
the owner is appropriate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mvanhorn

Copy link
Copy Markdown
Contributor Author

Fixed in a6c7c83 — collapsed mkdir + chown into install -d -m 0700 -o deepseek -g deepseek /home/deepseek/.deepseek. Since the directory holds API keys, 0700 is the right default. Thanks for the catch.

@Hmbown

Hmbown commented May 17, 2026

Copy link
Copy Markdown
Owner

Thanks for this. The Docker permission fix was harvested into v0.8.39 via #1734 and credited in the changelog, so I am closing this PR to keep the queue clean. If the latest GHCR image still fails with the README named-volume command, please reopen or file a fresh repro and we will treat it as a v0.8.40 blocker.

@Hmbown Hmbown closed this May 17, 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.

Docker: Permission denied (os error 13) creating .deepseek/tasks/runtime/threads on first run

2 participants