All articles
AI Engineering· 4 min read

Docker Sandboxes for AI agents: what the microVM isolates and what it leaves open

Docker's security model for its local AI agent sandboxes gives the agent sudo inside a microVM and relies on the VM as the main trust boundary. That boundary protects the host well, but the workspace, credentials in use, egress and shared integrations stay reachable for the agent.

Key points

  • Inside the microVM the agent has full rights, including sudo; the VM protects the host, not shared resources.
  • Direct mode exposes the live working tree, including Git hooks and build scripts that run implicitly.
  • Default egress rules contain broad wildcards; review them with sbx policy ls.
  • Shared skills stores and local MCP servers extend the trust boundary beyond a single sandbox.
  • Docker's page is inconsistent on the skills default; verify against your version.

Docker has published a security model for Docker Sandboxes, which run AI coding agents in microVMs on a developer's machine [1]. The page covers local sandboxes only; cloud sandboxes behave differently and are described elsewhere [1]. Its central point is plain: inside the VM, the agent can do whatever it wants, sudo included [1]. That is a deliberate design choice, and it changes the question for teams. The main issue is less whether the agent can break out and more what it has been given access to.

What the microVM keeps out

Docker names the virtual machine as the primary trust boundary [1]. Every sandbox runs its own kernel under a hypervisor and shares neither memory nor processes with the host [1]. Containers the agent starts run on a separate Docker Engine inside the VM, with no link to the host's Docker daemon [1]. Apart from the workspace and an optional skills store, the agent has no route to the host filesystem or host processes [1]. Sandboxes cannot reach one another directly over the network, ICMP is blocked, and outbound UDP stays off unless an experimental feature is switched on and policy permits it [1].

Credentials are kept outside the VM. A proxy on the host adds authentication headers to outgoing HTTP requests, so raw API keys never reach the agent [1]. A forwarded SSH agent socket works in a similar way: processes in the sandbox can ask for signatures, while the private keys stay on the host [1].

What the boundary does not cover

The VM shields the host from the agent. It does not shield what you deliberately share with it. The documentation lists several such channels [1]:

  • Workspace. In direct mode, the project directory is mounted read-write and edits show up on the host at once. This includes files that run without anyone starting them on purpose, such as Git hooks, CI configuration, IDE tasks, Makefiles and package.json scripts [1]. Git hooks live in `.git/` and do not appear in `git diff`, so they need a separate check [1].
  • Egress. Outbound TCP passes through a host proxy with a deny-by-default policy, but the default allowlist contains broad wildcards. Docker itself notes that `*.googleapis.com` covers far more than AI services [1]. The documentation does not mention any inspection of content, so data the agent can read may leave through any permitted destination.
  • Credentials in use. Keys stay hidden, but the agent can still use them: it sends authenticated requests through the proxy and can request SSH signatures [1].
  • Shared skills. If the shared skills store is writable, one sandbox can change instructions or scripts that an agent in another sandbox runs later, even one with read-only access [1]. According to Docker, all participating sandboxes then sit inside one trust boundary [1]. The page contradicts itself on the default: one passage says read-only, another says read-write unless you opt out [1]. Check how your version behaves.
  • MCP servers. Local stdio MCP servers run on the host, not in the VM, and use host permissions [1]. Docker recommends regarding them as trusted parts of the host [1].
  • Kits and persistent state. Kits run their install commands as root inside the sandbox; by default, only Docker Hub is allowed as a source [1]. Installed packages, images and other VM state survive restarts [1].

Concrete controls

  • Use clone mode (`--clone`), which mounts the repository read-only and gives the agent its own copy, or a mountless sandbox for tasks that need no project files [1].
  • In direct mode, review all changes before building or running anything, and inspect `.git/hooks` and CI files separately [1].
  • List active rules with `sbx policy ls` and delete allowlist entries you do not need [1].
  • Decide for each sandbox whether it should share the skills store, and opt out for untrusted work [1].
  • Register only MCP servers you would trust with host-level access [1].
  • Keep the kit source allowlist narrow [1].
  • Move network, filesystem and MCP policies to the organization level so they do not depend on each developer's local setup [1].

What remains unclear

This article rests on a single vendor page [1]. It has not been tested independently, and the linked subpages on default posture and isolation layers were not reviewed here. Teams should read the full documentation for their version before relying on these controls.

Sources

  1. [1]Security model · docs.docker.com · 3 November 2026

Written with AI from the sources above and checked by our team.

Available experts in this field

See available experts →

Open searches in this field

See skills wanted →

Your skills are not listed?

Upload your CV once. We match you with every new project in your field and tell you why it fits.

Upload your CV