Skip to content

Instantly share code, notes, and snippets.

@SabatinoMasala
Last active February 15, 2026 16:43
Show Gist options
  • Select an option

  • Save SabatinoMasala/2ce46fc06b3234ccddfde242832904e1 to your computer and use it in GitHub Desktop.

Select an option

Save SabatinoMasala/2ce46fc06b3234ccddfde242832904e1 to your computer and use it in GitHub Desktop.
Use Claude Code max plan with Docker sandbox
FROM docker/sandbox-templates:claude-code
USER root
# ... Install extra dependencies
# Wrap claude binary to ensure onboarding is marked complete before launch, make sure the host exposes CLAUDE_CODE_OAUTH_TOKEN as an environment variable (get it using claude setup-token)
RUN CLAUDE_PATH=$(which claude) \
&& mv "$CLAUDE_PATH" "${CLAUDE_PATH}.real" \
&& printf '#!/bin/bash\ntest -f /home/agent/.claude.json || echo "{}" > /home/agent/.claude.json\njq ".hasCompletedOnboarding = true" /home/agent/.claude.json > /tmp/.claude.json && mv /tmp/.claude.json /home/agent/.claude.json\nexec "%s.real" "$@"\n' "$CLAUDE_PATH" > "$CLAUDE_PATH" \
&& chmod +x "$CLAUDE_PATH"
USER agent
@SabatinoMasala

Copy link
Copy Markdown
Author

Getting a token

On your host, run:

claude setup-token

Follow the instructions and export this environment variable in your ~/.zshrc

export CLAUDE_CODE_OAUTH_TOKEN=sk-ant-...

Restart Docker desktop to make sure it loads the environment variables.

Build the sandbox image

docker build -t custom-sandbox .

Run the sandbox, this will now be authenticated

docker sandbox run --load-local-template -t custom-sandbox:latest claude .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment