"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:
A secrets file sits in a host directory.
Container A starts without that directory mounted. Reading the file fails, as expected.
Container A starts again, this time with the Docker socket mounted.
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:
A read-write mount and a read-only mount behave exactly as advertised: an edit to the writable file appears on the host, an edit to the read-only file fails with a filesystem error. Boundary behaviour you can test in two commands is boundary behaviour you will actually trust.
When a reference folder had to be protected, the setup used both a read-only mount and a prompt instruction telling the agent not to copy from it. The write-up keeps these distinct: the mount prevents the change, the instruction only requests it. That distinction is the whole discipline in one sentence.
Tradeoffs
Isolation strength against workflow friction. A microVM per agent costs disk (its own VM image and its own image cache, shared with nothing) and startup time, and it fragments caches across sandboxes. For an agent editing text in one repository, a container with no socket is sufficient and much cheaper.
Approval prompts against approval fatigue. The write-up names the real failure mode of host-level controls: the tool asks so often that the human clicks approve without reading, at which point the guardrail is decorative. A boundary that needs no per-action consent is worth more than a stricter policy nobody reads.
Credentials outside versus convenience inside. Authenticating outside the sandbox is the right call and means the agent cannot read its own keys; it also means the sandbox cannot be recreated from scratch without that external step.
Shared folders are a two-way street. Writes inside the sandbox land on the host. The boundary is on which folders, not on whether changes propagate.
Failure modes to design against
Socket mounting as a convenience. Any instruction, Compose file or blog post that says to mount
docker.sockinto an agent container is removing the boundary. Treat it as a privilege grant, not a configuration detail.Confusing a prompt rule with a permission. "Do not modify this folder" in a prompt is advice to a model. Only the mount is enforcement.
Over-trusting "it's in a container". Process and filesystem namespaces say nothing about what services the process can reach. Enumerate the sockets, the network egress and the mounted paths, not the isolation technology's name.
Malicious input arriving through dependencies. The write-up is careful here: an agent does not decide to attack the host; code reaching it through a dependency, file or tool runs with the access the agent already has. The blast radius is whatever you granted, which is the thing to minimise.
Remote or cloud-synced workspaces. Docker's docs warn against mounting network drives, SMB/NFS shares or cloud-synced folders as a sandbox workspace, because the file-sharing layer is not built for them.
Disk growth going unnoticed. Per-sandbox images and layers accumulate, and nothing is shared between sandboxes.
Review checklist
For any sandbox you are about to hand a coding agent:
Is the host Docker socket (or any equivalent privileged socket) reachable from inside? If yes, the sandbox is a host-privileged process.
Can the agent create new execution contexts, and if so, who decides their mounts?
Which host paths are mounted, and which of them are read-write? Test one read-only mount before trusting the configuration.
Where do credentials live — inside the workspace the agent can read, or outside it?
What network destinations are reachable, and can you print that policy without reading source?
What happens to host files when the sandbox is removed? Which state is private and which survives?
Does any protection in your setup exist only as a sentence in a prompt?
Which rung of the ladder does this task actually need? Document the reason, so the next person does not quietly mount the socket to make something work.
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.
Related
R030 — kernel-enforced sandboxes and verified policy for agents.
R305 — OS containment plus a policy language, and its own concession that this is weaker than a VM boundary.
R296 — live-forking a running sandbox to clone stateful tool sessions.
R122 — a runtime that gives every actor a gVisor or microVM sandbox with no network path to its siblings.
R334 — a personal agent whose documentation describes a VM in one place and containers in another, in the category where that difference matters most.