Est.
FeaturesLong read

Docker Sandbox vs Container: What the Difference Means for AI Code Execution

AI agents need stronger isolation than Docker containers were designed to provide.

· 10 min read
Cover illustration for “Docker Sandbox vs Container: What the Difference Means for AI Code Execution”
Features · October 7, 2026 · 10 min read · 2,176 words

Docker containers isolate workloads through Linux namespaces and cgroups, two kernel features that separate what a process can see and how much of the machine it can use. Neither mechanism gives a container its own kernel. No matter how many containers run on a host, each one makes system calls into one kernel, the same kernel the host itself depends on. That shared kernel is efficient. It is the structural fact that determines how much trust a container can safely be asked to hold, because a vulnerability in the kernel, or a misconfiguration in how a container is launched, can let a process escape its namespace boundary and reach the host directly. Northflank's sandboxing guide states that Docker containers are suitable for trusted, vetted code running in single-tenant environments, and that the moment the code's origin is an LLM or an untrusted user, a different stack is required.

For most of Docker's history, this was a reasonable bargain. No one asked containers to defend against the code running inside them. That model holds up fine for a CI pipeline running a test suite someone wrote last week, and it holds up fine for a web service built from code that passed review. It breaks down once the code was never reviewed by anyone.

That is the condition AI agents introduce. When an agent writes its own Python scripts, decides which packages to install, and opens or manipulates file descriptors on its own initiative, the shared kernel changes from a minor theoretical exposure into a surface that untrusted, machine-generated logic touches directly. The container was built to isolate code a human already trusted. It was never built to contain code a model just invented.

What changes when AI agents write the code

The core shift is procedural: AI agents remove the review step that container security quietly depended on, and every execution becomes an untrusted event the infrastructure has to contain on its own. A developer wrote each line of a conventional application, read it, and chose to ship it, so the container running that application inherits a layer of trust that was established before the code ever reached the runtime. An AI agent generates code dynamically, in response to a prompt, a goal, or an evolving plan, with no equivalent human checkpoint between generation and execution.

Northflank's sandboxing guide frames the response to this shift as a zero-trust network model, in which connections must be explicitly allowed. The risk does not require an adversarial prompt or a malicious user. An agent acting in good faith can still install a hallucinated package name that happens to exist and happens to be malicious, which opens a supply-chain path into the runtime without anyone intending it.

The response to this shift is no longer theoretical at the infrastructure level: AWS, Azure, and GCP have each moved their own control planes away from runc and toward hardware-enforced isolation. When the three largest cloud providers independently retreat from shared-kernel isolation for their own control planes, that is a verdict on the architecture, rendered by the organizations with the most operational experience of what goes wrong at scale.

The isolation spectrum: what containers, gVisor, and microVMs guarantee

Diagram: The Isolation Spectrum: Containers, gVisor, and MicroVMs. Visualizes: Visualize three levels of workload isolation as a vertical spectrum or ranked ladder, moving from weakest to strongest: (1) Standard containers (Docker/Podman) — shared…

Mapping that spectrum is what makes it possible to say precisely where Docker sits, and precisely what it does and does not promise.

Standard containers, whether run through Docker or Podman, sit at the first level. Processes inside containers share the host kernel, so startup is fast and resource overhead is low, but the isolation boundary holds only if the kernel does. For AI-generated code, whose behavior cannot be vetted in advance, that boundary is categorically insufficient.

The second level is occupied by user-space kernels, of which gVisor is the clearest example. gVisor intercepts system calls in user space before they ever reach the real kernel, which shrinks the kernel's exposed attack surface substantially compared to a standard container. It sits meaningfully above containers in security and meaningfully below a full virtual machine in overhead, which is exactly the middle position its design targets.

The third level belongs to microVMs, including Firecracker and Kata Containers, where each workload gets a dedicated Linux kernel running on hardware virtualization through KVM. An exploit that compromises the guest kernel in this model is still confined to that guest; it has no path to the host or to a neighboring workload, because there is no shared kernel for it to escape into. Kata Containers adds a virtual machine monitor layer on top of the same hardware-isolation principle, so it costs some boot speed relative to Firecracker, but that makes it a natural fit for regulated and zero-trust environments, where the audit trail matters as much as the millisecond count. You will need that regulated-environment fit later, when sandbox platforms get compared on compliance posture.

The honest tension in this spectrum is that stronger isolation has historically meant slower cold starts, and a few years ago that tradeoff was severe enough to rule microVMs out for latency-sensitive agent loops. The sections ahead make the case that purpose-built sandbox platforms have narrowed that gap enough that it no longer functions as a real objection to choosing stronger isolation.

Docker's own September 2026 admission that containers are not enough for agents

If the argument so far rests on a technical account of namespaces, cgroups, and kernel-sharing, it also needs a verdict from someone with no reason to overstate the problem. Docker gave that verdict itself. On September 24, 2026, Docker launched Cloud Sandboxes, with the company that built the container runtime the entire industry standardized on publicly stating that containers were not built to give AI agents the isolation they need, drawing a line between what containers do and what agentic AI workloads require.

The product Docker built to answer that gap abandons the container model. Cloud Sandboxes run on microVM-based isolation, with each sandbox given a dedicated microVM, its own kernel, and hardware-level isolation from the host and from every other sandbox. Rather than adopt an existing microVM technology such as Firecracker or libkrun, Docker built a custom virtual machine monitor for the purpose, a cross-platform VMM that runs natively on macOS and Windows through each platform's own hypervisor, with Linux support planned for general availability in late October 2026. The design target is unattended, long-running agent workflows: when a developer closes a laptop, the agent's work continues on Docker-managed infrastructure rather than stopping, and each sandbox can be killed and restarted on demand as the workflow requires.

Treat this launch as the moment the "containers versus sandboxes" question stopped being a matter of interpretation. Docker's own engineering leadership chose to rebuild isolation from the kernel up rather than extend the container model it is famous for, which settles, from the most credible possible source, the question the first four sections of this piece exist to establish: containers and purpose-built sandboxes are different tools solving different threat models, and AI agents belong squarely in the second category.

What a purpose-built sandbox must guarantee

Once the industry accepts that containers were not built for this threat model, it becomes clear what a replacement actually needs to guarantee. Four requirements fall directly out of the failure modes already described: isolation strength, startup speed, statefulness, and network control. Each maps to a specific way containers fall short, which makes the list a workable checklist for evaluating any sandbox platform, including the ones compared in the next section.

Hardware-level isolation comes first, because every argument in this piece traces back to the shared kernel. An execution environment for untrusted, AI-generated code needs its own kernel, full stop on the shared-kernel model: that architecture is off the table once the code running inside it was never reviewed by a person.

Near-instant provisioning comes second, because agents do not just execute code once. Sub-second startup is a functional requirement for the workload, not a convenience.

Statefulness and persistence come third, because the ephemeral container model, spin up, run, destroy, was built around short jobs with no memory between invocations. A multi-step agent working on a task over minutes or hours needs durable state: session logs, checkpoints, and filesystem snapshots that survive between steps so that progress is not lost every time a step completes. Three persistence patterns have emerged to meet this need. Snapshot-and-fork sandboxes take a pre-warmed virtual machine and fork it per task or per branch of exploration, so if an agent needs to try several approaches to the same problem, it does not have to re-provision from scratch each time.

Network and credential controls come fourth, because an isolated kernel answers only part of the threat model. Egress firewall rules and credential proxying are necessary so that a compromised or misbehaving agent cannot exfiltrate secrets or reach endpoints it was never authorized to contact, even if its code execution is otherwise perfectly contained.

None of these four requirements function as a substitute for the others. Production-grade AI agent sandboxing requires all of them layered together, isolation boundaries, resource limits, network controls, permission scoping, and monitoring, because a single strong control with three weak ones still leaves an opening.

How leading sandbox platforms meet those requirements

Measured against that four-part checklist, sandbox platforms differ in real and specific ways: isolation mechanism, startup speed, statefulness, support for bringing your own cloud, and compliance posture all vary from one provider to the next, and those differences determine which platform fits which deployment.

Daytona was built for what autonomous AI systems need, so you are not adapting tooling designed for human developers. Sandboxes are stateful by design and can run indefinitely, so a long-running agent resumes work exactly where it left off instead of absorbing a fresh cold-start cost on every step: this is the persistent-paused pattern described in the previous section, realized as a product. Isolation is handled through a fully separated runtime: AI-generated code executes in environments that cannot reach the underlying infrastructure, addressing the hardware-level isolation requirement directly. On compliance, Daytona holds SOC 2 Type I and Type II certification and meets HIPAA and GDPR standards, and you get that posture built into the platform, not sold as a premium tier for enterprise customers willing to pay more.

If you evaluate this category, you generally weigh a handful of distinct approaches against each other, beyond this one named platform. Some teams choose to bring their own cloud account and run sandbox infrastructure inside it, so they trade some operational simplicity for control over where data lives and how billing is structured. Each approach makes a different tradeoff among the four requirements: isolation strength, startup speed, statefulness, and network control, and the right choice depends on which of those four a given workload is least willing to compromise on. If you run regulated healthcare data through an agent, you will weight compliance posture and isolation strength heavily, in a way a team prototyping an internal tool may not need to.

How coding agents handle sandbox isolation today

A July 2026 audit of production coding agents found that isolation strategy varies widely across the field. If there were an obvious, settled answer to how agentic code execution should be isolated, the major agent frameworks would likely have converged on it by now, and they have not.

OpenHands uses a workspace abstraction that spans Docker, Apptainer, a remote API, and cloud workspaces with KVM passthrough handled on the application side, giving operators a menu of isolation backends. Codex takes a different path, relying on vendored Bubblewrap combined with Landlock and seccomp on Linux, Seatbelt on macOS, and restricted tokens on Windows, a platform-specific stack built around each operating system's native sandboxing primitives. Gemini CLI supports Docker, Podman, Bubblewrap, gVisor through runsc, and LXC on Linux, with Seatbelt on macOS, and lets operators configure tool-call rules through TOML policy files, offering a selection of backends.

The pattern across all three is instructive on its own terms. Docker appears repeatedly in these stacks because it is the backend every operator's machine can already run, not necessarily the backend that gives an agent's untrusted code the strongest boundary available.

Computer-use agents raise further isolation demands. Cursor's February 2026 update introduced Computer Use, which spins up an isolated Ubuntu virtual machine for each cloud agent session, clones the relevant repository into it, and has the agent work on a dedicated branch inside that VM. Each additional service listening, each additional process rendering a display, is one more thing that has to be secured correctly.

Seen side by side, the three frameworks and the computer-use pattern show the same shape of gap: isolation choice in production agent systems today is being made ad hoc, backend by backend, instead of according to a standard that names the isolation level a given workload requires and enforces it by default. That is precisely the gap the isolation spectrum, the Docker Cloud Sandbox launch, and the requirements checklist in this piece are meant to help close, by giving engineers a vocabulary for naming what they need before they reach for whatever backend happens to already be installed.

Sources

  1. Harness Engineering: Anatomy, Architecture, and Evolution of Coding Agents -- A Source-Code Study of Eleven Systems

More in Features