Run Claude Code in a box when you want an interactive coding agent inside a remote, forkable workspace. This works well when you want to prepare one baseline once, then open parallel task boxes that all start from the same repo and tools.
Prepare the box
run9 box create claude-lab --image docker.io/library/node:22-bookworm
run9 box exec claude-lab -it bash
Inside that shell:
# inside the shell:
apt-get update
apt-get install -y git
npm install -g @anthropic-ai/claude-code
mkdir -p /work
git clone <your-repo-url> /work/your-repo
ls /work/your-repo
exit
Replace <your-repo-url> with the repo URL you actually use. For the smoothest first setup, start with the HTTPS URL for that repo. If the repo is private, or you prefer an SSH repo URL, prepare the Git credential you need inside claude-lab first. Product SSH only gets you into the box: it does not forward your laptop SSH agent, and the Profile / SSH Keys entry only authenticates box login.
If git clone succeeds and ls /work/your-repo shows your files, later task boxes will inherit that checkout path.
Treat claude-lab as the reusable baseline box. Put your repo, language toolchain, and project dependencies here before you fork, so later task boxes all start from the same prepared state.
That baseline is what lets you Fork & Scale naturally: one snap can become claude-fix-login, claude-write-tests, claude-repro-bug, or any other isolated task branch you need.
Configure Anthropic in Portal
Before starting Claude Code, configure the org-level gateway:
- Open Portal.
- If you are on
My Orgs, clickSettingson the org that ownsclaude-lab. - If you are already inside that org workspace, use the left sidebar
Org Settings. - Open
AI Integrations. - Open the
Anthropic / Claude Codecard. - Paste your real provider secret into
Upstream API Key. - Leave
Custom Endpointempty unless you intentionally want a custom upstream. - Turn
Enabledon. - Click
Save.
If you are not an org owner, ask an owner to do this once for the org.
Fork a task box from the prepared baseline
When claude-lab has the repo and tools you want every task to inherit, freeze that state and branch from it:
run9 box stop claude-lab
run9 snap fork --from-box claude-lab
run9 box create claude-fix-login --snap <forked-snap-id>
run9 box create claude-write-tests --snap <forked-snap-id>
run9 box create claude-repro-bug --snap <forked-snap-id>
Keep claude-lab as the reusable baseline. Use claude-fix-login for the real Claude Code session below so later forks still start from the clean prepared state.
Start Claude Code through AI Gateway
run9 box exec claude-fix-login -it bash
Then move into the repo checkout you prepared in claude-lab before you start Claude Code.
Inside that shell:
# inside the shell:
cd /work/your-repo
export ANTHROPIC_BASE_URL=http://10.0.2.2:1000/run9/ai/anthropic
export ANTHROPIC_AUTH_TOKEN=run9-placeholder
claude
Replace /work/your-repo with the path you prepared in claude-lab. Start Claude Code from that checkout so the task session opens on the inherited repo instead of the shell’s default directory.
These ANTHROPIC_* exports are shell-local. Re-export them in each new shell, or save them in the shell profile or wrapper script you use to launch Claude Code.
Inside the box, the only Anthropic-specific settings are the gateway base URL and the placeholder token. The literal run9-placeholder is only a client-side stand-in, and the real upstream secret stays in the org integration.
If Claude Code fails before the first prompt, check the org Anthropic / Claude Code card is still Enabled, then confirm this shell still uses the gateway URL and ANTHROPIC_AUTH_TOKEN=run9-placeholder.
claude-fix-login starts with Claude Code, Git, and anything else you prepared in the parent box. Create more boxes from the same snap when you want parallel Claude task branches.