Skip to main content
NOV 2026 Latest guide updates. Latest: AI Design Patterns Local vs cloud AI Grill me Changelog →
T17 Advanced Technical

Sandbox: Native vs Docker

Choosing the right isolation level for your context

PDF editions Β· Guide v3.44.1 Β· Updated

Compare the actual boundaries

Claude Code’s native Bash sandbox uses OS process isolation. Docker Sandboxes provides a separate environment for an agent, with local microVM and cloud options. The current Docker documentation uses the sbx CLI; check its installation and platform requirements before adopting commands from older docker sandbox examples.

AspectNative Claude sandboxDocker Sandboxes
BoundaryOS process isolationSeparate sandbox environment
KernelShares the host kernelLocal microVM has a separate kernel
Setup/sandbox; Linux requires dependenciesInstall and configure sbx
WorkspaceCurrent and explicitly added directoriesConfigured workspace mounts and synchronization
NetworkDomain policy and permission flowSandbox network policy
Cost and performanceMeasure your commandsMeasure compute and model use separately

Native sandbox

macOS uses Seatbelt; Linux and WSL2 use bubblewrap and socat. Native Windows and WSL1 are not supported by Claude Code’s native sandbox.

/sandbox

In regular permissions mode, existing permission rules still apply. Auto-allow reduces prompts for sandboxed commands, with documented exceptions. Inspect the unsandboxed retry policy before relying on isolation.

Docker Sandboxes

Follow the current Docker Sandboxes documentation for sbx, supported platforms, local/cloud differences, hardware access and workspace behavior. Do not assume an older Docker Desktop version or a historical platform table describes the installed release.

A microVM adds a kernel boundary but does not guarantee immunity from escape, misuse of credentials or damage to mounted workspaces. Bypassing agent permission prompts still requires deliberate restrictions on accessible data and external services.

Choosing an environment

  • Use the native sandbox for commands whose required access fits its filesystem and network controls.
  • Evaluate a separate sandbox when the workload needs stronger separation or its own services.
  • For unattended work, verify credentials, mounts, network rules, budget and recovery behavior before granting autonomy.
  • Measure overhead and completed-task outcomes instead of relying on universal CPU or memory percentages.

Open-source runtime

Anthropic also publishes a sandbox runtime that can wrap other commands:

Terminal window
npx @anthropic-ai/sandbox-runtime node mcp-server.js

Source: Claude Code sandboxing.

Enter your email to read the full card and get the complete PDF bundle.

All content is free and open-source. We just ask for your email.

PDF: