fix(docker): run as non-root so claude bypassPermissions works - #14
Merged
Merged
Conversation
Latest deploy logs: karpathy_failed pr=26610 err=no_json rc=1 stderr_tail= --dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons karpathy_check.py hard-codes `--permission-mode bypassPermissions` in _invoke_claude(), and claude refuses that mode under uid 0. The container was inheriting the default root user from python:3.12-slim, so every karpathy invocation aborted before producing any JSON. Fix: create a `bot` user (uid 1000), install claude under bot's $HOME so the binary lives where the runtime user can exec it, chown /opt/litellm to bot so per-call `git fetch` / `git worktree add` succeed without sudo, and `USER bot` before CMD. /app stays root-owned — bot only needs read access there; karpathy's per-call tempdirs go to /tmp. Made-with: Cursor
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
Followup to #11 / #12. Latest deploy got past
no_skill, surfaced:karpathy_check.pyhard-codes--permission-mode bypassPermissionsin_invoke_claude(), and claude refuses that mode under uid 0. The container was inheriting the default root user frompython:3.12-slim, so every karpathy invocation aborted before producing any JSON.Fix
botuser (uid 1000) with--create-home./opt/litellmasbotso per-callgit fetch origin pull/N/headandgit worktree addsucceed without sudo.bot's$HOMEso the binary lives at/home/bot/.local/bin/claude— the path the runtime user can actually exec.USER botbeforeCMD./appstays root-owned —botonly needs read access there, karpathy's per-call tempdirs go to/tmp, and_persist_runwrites to Postgres rather than disk.Test plan
karpathy_doneinstead ofkarpathy_failedreview_pr.karpathy_ran=trueshows up on thereview_prLogfire spanMade with Cursor