Claude Code is Anthropic's terminal-based AI coding agent that can read code, modify files, and execute commands within a sandbox. We have pre-built Claude Code images in ACR across all regions, so you don't need to push images or configure ACR EE yourself. Simply select an image address below and build a template using from_image + Template.build to get started. This page covers image specifications and complete usage: prerequisites, image addresses, building a Template, creating a sandbox, running Claude Code, environment and capability notes. For scenario tutorials such as cloning repositories, connecting MCP, extending Skills, and structured output, see Use Claude Code Sandbox.
For first-time use, complete the prerequisite preparation, API key creation, and SDK setup described in Use FC Agent Sandbox with the SDK.
Prerequisites
-
Completed SDK integration (E2B API Key,
api_url,domain) -
Installed dependencies:
pip install e2b==2.31.0 e2b-code-interpreter==2.8.1 -
Prepared a model API Key to inject via
envswhen creating the sandbox — images do not include pre-configured keys-
China: Obtain an API Key (starting with
sk-) from the Bailian Console -
International: Obtain
ANTHROPIC_API_KEYfrom the Anthropic Console
-
Image Addresses
Select FROM_IMAGE by region:
| Region | Image |
| cn-beijing | fc-e2b-registry.cn-beijing.cr.aliyuncs.com/runtime/claude-code:v0.0.44 |
| cn-shenzhen | fc-e2b-registry.cn-shenzhen.cr.aliyuncs.com/runtime/claude-code:v0.0.44 |
| ap-southeast-1 | fc-e2b-registry.ap-southeast-1.cr.aliyuncs.com/runtime/claude-code:v0.0.44 |
| cn-hongkong | fc-e2b-registry.cn-hongkong.cr.aliyuncs.com/runtime/claude-code:v0.0.44 |
| cn-shanghai | fc-e2b-registry.cn-shanghai.cr.aliyuncs.com/runtime/claude-code:v0.0.44 |
| cn-hangzhou | fc-e2b-registry.cn-hangzhou.cr.aliyuncs.com/runtime/claude-code:v0.0.44 |
Recommended build specifications: cpu_count=2, memory_mb=8192.
Quick Start
The following example uses the Beijing region and consists of four steps: Build Template → Create Sandbox → Run Claude Code → Destroy Sandbox.
Build Template
import time
from e2b import Template, default_build_logger
FROM_IMAGE = "fc-e2b-registry.cn-beijing.cr.aliyuncs.com/runtime/claude-code:v0.0.44"
TEMPLATE_NAME = f"claude-code-{int(time.time())}"
OPTS = {
"api_key": "<your E2B API Key>",
"api_url": "https://api.cn-beijing.e2b.fc.aliyuncs.com",
"domain": "cn-beijing.e2b.fc.aliyuncs.com",
}
build = Template.build(
Template().from_image(FROM_IMAGE),
name=TEMPLATE_NAME,
cpu_count=2,
memory_mb=8192,
on_build_logs=default_build_logger(),
**OPTS,
)
print(f"template: {build.name}") # Save for later reuse
After the build completes, the template status in the console should be ready. You can create multiple sandboxes from the same template name without rebuilding each time.
Create Sandbox
Inject the model API Key via envs when creating the sandbox.
International: Anthropic direct connection
from e2b_code_interpreter import Sandbox
sandbox = Sandbox.create(
template=TEMPLATE_NAME,
envs={"ANTHROPIC_API_KEY": "<your-anthropic-api-key>"},
timeout=600,
**OPTS,
)
# You must initialize `~/.claude.json` before the first run, otherwise a corrupted config error may occur.
sandbox.commands.run("echo '{}' > /home/user/.claude.json")
Run Claude Code
Use -p for non-interactive mode; within the sandbox you can add --dangerously-skip-permissions to skip permission confirmations. It is recommended to add < /dev/null to avoid stdin waiting warnings:
result = sandbox.commands.run(
'claude --dangerously-skip-permissions < /dev/null '
'-p "Create a hello world HTTP server in Go"',
timeout=0,
)
print(result.stdout)
Destroy Sandbox
Release resources when the task is complete:
sandbox.kill()
Environment Overview
| Item | Specification |
| Operating System | Ubuntu 25.04 |
| Claude Code Path | /home/user/.local/bin/claude |
| Default User / Working Directory | user / /home/user |
| MCP Gateway | Not supported |
MCP and Skill Capability Notes
| Capability | Support |
claude mcp add (stdio / HTTP) |
Supported |
SDK mcp creation parameter |
Not supported |
getMcpUrl() / getMcpToken() |
Not supported |
| Scope | Path |
| Personal (global within this sandbox) | /home/user/.claude/skills/<name>/SKILL.md |
| Project | <project>/.claude/skills/<name>/SKILL.md |
For complete MCP and Skill examples, see Use Claude Code Sandbox.