R345 · Agent principles and patterns › Formal constraints on agent actions

The Docker socket is the hole: isolation levels for coding agents

Read the original

Authors Aiza Hasib

agent-securitysandboxinghuman-oversightcontainersdeveloper-toolingvendor

"Run the agent in a container" is the standard answer to agent safety, and it is incomplete in a way that is easy to demonstrate and hard to notice. A recent write-up of a guest lecture by a Docker Captain and Apple engineering manager makes the case concretely, and Docker's own documentation for its newer sandbox product confirms the mechanism it proposes instead. The useful content is not the product; it is the ladder of isolation levels and the precise reason the middle rung leaks.

The ladder

Host controls. Tools such as the major coding-agent CLIs apply an authorization policy on the machine itself: which commands may run, which files and directories may be touched. The agent is still a process on the host. Everything rests on the policy being complete and on the human honouring the prompts.

Container. Processes and filesystem are separated from the host. You choose which folders are mounted, and whether the container gets network or socket access. This is where most teams stop.

MicroVM. Its own kernel and filesystem, its own network policy, its own credential handling, and — the part that matters here — its own Docker daemon.

The write-up is explicit that the top rung is not always required. The right level depends on what the agent is doing and how much access it needs, and over-isolating has real costs in setup and friction.

Why the container rung leaks

The failure does not require a kernel exploit, which is what makes it worth knowing. A plain container has no Docker engine of its own. So when an agent inside it needs to build or run containers — ordinary behaviour for anything doing integration tests or multi-service work — the common workaround is to mount the host's Docker socket into the container.

That socket is a door to the daemon running outside the container. Through it, the contained process can ask the host daemon to create a second container, and it can specify that second container's mounts. The demo is four steps:

  1. A secrets file sits in a host directory.

  2. Container A starts without that directory mounted. Reading the file fails, as expected.

  3. Container A starts again, this time with the Docker socket mounted.

  4. Container A asks the host daemon for Container B, with the secrets directory mounted into it. Container B reads the file and prints it.

The two containers are siblings, not nested — A never ran Docker itself. It used an access grant it had been given. The lesson generalises past Docker: any capability that lets a sandboxed process ask a more privileged service to act on its behalf is a hole in the sandbox, and it will not look like an escape in any log.

What a sandbox with its own daemon changes

Give the sandbox a private Docker daemon inside a microVM and the agent can still build images and run multi-service applications — but those operations happen inside its own boundary rather than against the host's engine. Docker's own documentation states that each sandbox keeps its own daemon state, image cache and package installations, that sandboxes share no images or layers, and that each consumes disk for its own VM image on top of container layers and volumes.

The controls exposed around it are the conventional set, and all of them are inspectable before the agent is given work: which host folders enter, read-only or read-write, which network destinations are reachable, and how much CPU and memory the sandbox gets. Workspace mounts are optional entirely in recent versions — omit them and the sandbox has no host bind mount at all. Credentials are authenticated outside the sandbox, so the agent's keys need not live in the environment it can read.

Two details from the demos are worth transplanting regardless of tooling:

Tradeoffs

Failure modes to design against

Review checklist

For any sandbox you are about to hand a coding agent:

What this does not establish

The write-up is a summary of a lecture, written by a third person, so it is second-hand twice over; the architectural claims above were checked against the vendor's own documentation, though not against its dedicated isolation page. There are no measurements anywhere in it: no startup time, no overhead figure, no comparison against other agent sandboxes, and no adversarial testing of the microVM boundary itself. Treat it as a correct account of a mechanism and a clear demonstration of one failure, not as evidence that this boundary holds against a determined attacker.

Part of the Research notes on nowucca.com. Figures and claims are the source's own unless the summary says otherwise.