Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Docker 5 min read How-to mediumAdept

Where should your code live in a Docker Sandbox?

Docker's sbx sandboxes for coding agents support three ways to place a repository, and each changes how the human participates. Mounting the host checkout gives live shared editing and hot reload, but branch switches and dependency installs are shared, and native binaries like esbuild can break across Linux and macOS/Windows. Mounting a host git worktree isolates tasks but leaves the agent without Git, because the .git file points outside the mount. Clone mode or a mountless sandbox keeps an independent checkout with full Git, at the cost of handoff via remotes, `sbx ports` publishing for previews, and losing files when the sandbox is deleted.

Assumes: Git worktrees and remotesDocker basics

Related posts

  • Running AI agents in GitHub Actions with Docker Sandboxes

    Docker mediumAdept

    GitHub Agentic Workflows (gh-aw 0.82.9) supports Docker Sandboxes (sbx) as an agent runtime, so a CI coding agent gets root, sudo and unrestricted shell inside a disposable microVM with its own kernel and private Docker daemon. Outside that VM it is limited by a network allowlist, a read-only token and a safe-output job that may only touch src/**. In the worked example, a Copilot agent on an ubuntu-24.04 runner runs a Java 21 Testcontainers/PostgreSQL suite, adds a regression test exposing a case-sensitive email uniqueness bug, applies a one-line normalization fix, and opens a draft PR. The run took about 11 minutes, and setup needs Docker credentials as secrets plus a KVM-capable host for self-hosted runners.

  • Why AI Agents Need Isolation

    Docker easyNovice

    AI coding agents that run commands, install packages and handle credentials should execute behind an isolation boundary rather than directly on the developer's host. Docker Sandboxes (sbx) runs agents in microVMs instead of plain containers, because containers share the host kernel. Docker built its own VMM rather than using Firecracker so the same model works on macOS and Windows as well as Linux. Credentials stay on the host: the agent sees a sentinel placeholder, and a proxy swaps in the real auth header on outbound requests. Sandbox Kits package tools, network rules, credentials, files, startup commands and agent memory (e.g. AGENTS.md) into reusable specs, either as stackable Mixin Kits that extend an existing agent or as Agent Kits that define a full agent environment from scratch.

  • Agents in the Sandbox

    Railway mediumAdept

    Railway sandboxes now ship Claude Code, Codex, OpenCode and Pi in the default image and can join an environment's private network, which lets agents test against real Postgres, Redis and internal services. The suggested workflow builds a template, configures a sandbox, takes a disk checkpoint, then creates or forks sandboxes from it so parallel agents start from a prepared workspace. Templates are cached builds from shell instructions, checkpoints are server-side disk snapshots that outlive the source sandbox, and forks clone a running sandbox's files but not its processes. TypeScript SDK and CLI examples cover detached agent sessions you can reattach to, port forwarding and a four-agent repo review app.

  • Building AI Teams: How Docker Sandboxes and Docker Agent Transform Development

    Docker mediumAdept

    Docker Agent defines teams of specialized AI agents in YAML, where a root "product manager" agent delegates to designer, engineer, QA and fixer sub-agents, each with its own model, instructions and toolsets (filesystem, shell, think, todo, memory, MCP). Docker Sandboxes runs these agents inside dedicated microVMs (Docker Desktop 4.60+), mounting the project at the same absolute path, withholding host environment variables, and enforcing network allow/deny lists so agents can install packages and run commands without touching the host. A step-by-step walkthrough builds a Gradio bank app with a four-agent team. Limitations: everything is experimental, microVM sandboxes require macOS or Windows, and only one sandbox is allowed per workspace.

  • Docker Sandboxes vs. Containers: Choosing the Right Isolation for AI Agents

    Docker mediumAdept

    Containers are isolated processes sharing the host kernel. Docker Sandboxes are microVMs with their own kernel, filesystem, network and private Docker Engine, designed for autonomous coding agents that accumulate state for hours and act on untrusted instructions. A container escape or a mounted Docker socket can expose the host. In a sandbox, an escape lands in a disposable VM, and network egress and credential injection are enforced by a host-side deny-by-default proxy. The tradeoffs are hypervisor requirements, more memory and disk, and some configuration through Kits and sbxenv.yaml. The recommendation: sandbox the agent and containerize the application it works on.

The quest for software engineering knowledge.

Look:
Layout: