How to Bring Your Existing Dockerfiles to an Agent Runtime
Keep your Dockerfile and add the isolation, state, and controls agents need.

An existing Dockerfile can become the environment for an agent without being rewritten. The migration adds what the image cannot supply on its own, including stronger isolation, durable execution state, and controls over autonomous actions. The practical task is to preserve the environment while moving responsibility for execution into a runtime built to govern it.
Why existing Dockerfiles are the right starting point for agent migration
An engineer with a working Dockerfile has a reasonable first question. How much of this survives the move? Base image selection, package installation, and dependency pinning remain the Dockerfile’s responsibility in a Docker-native runtime. Those choices encode the runtime version and system dependencies that make the environment reproducible. The secrets handling and network assumptions already in place also show what the environment needs, even when the migration changes how those needs are met.
A self-hosted agent architecture can already be expressed in a docker-compose.yml containing an agent runtime container, an LLM gateway, a relational database for state, a vector store for memory, and a reverse proxy. That gives the migration a concrete starting boundary. The environment and its service dependencies are already described, but the runtime must add the controls needed to run the agent.
This distinction narrows the engineering work. The question is not whether the Dockerfile can describe an agent’s dependencies, but whether the system running that image can safely govern what the agent does with them. Reproducibility establishes the environment. It does not, by itself, establish the rules for autonomous work inside it.
Why containers alone are not sufficient for the execution model agents require
Standard containers share a kernel with their host. Because the kernel is shared, a kernel-level exploit can give a compromised container access to the host system. When AI-generated code runs autonomously, that shared boundary becomes an architectural concern. Docker acknowledged the limitation when it launched Docker Cloud Sandboxes on September 24, 2026. Docker President and COO Mark Cavage stated, “While the containers Docker is known for still have a critical role to play, they weren't designed for the level of isolation AI agents demand.”
Isolation is only part of the execution gap. Christopher Cruz’s February 2026 paper AI Runtime Infrastructure distinguishes execution-time intervention from model serving, orchestration, and post-hoc observability. Context overflow, compounding tool errors, and mid-workflow safety risks arise after work begins. Static orchestration and logs alone cannot deal with these risks. The runtime must be able to intervene while the agent is running, treating execution itself as an optimization surface.
That leaves two related questions for migration. What boundary contains the agent, and what layer governs its progress? MicroVM-based isolation gives each sandbox its own kernel and a hardware-level boundary, while gVisor has a user-space application kernel. Standard container isolation offers another point on the security-versus-startup tradeoff. Choosing among them addresses containment, but durable recovery and execution-time policy still need their own design.
What actually changes when you move a Dockerfile into an agent runtime
To start the migration, check the existing Dockerfile and its launch configuration for kernel assumptions, secrets handling, and network egress. Shared-kernel assumptions are the first source of incompatibility. Certain seccomp profiles, host-network mode, and privileged flags will not transfer cleanly into a microVM-isolated sandbox. Replace or remove those dependencies rather than assuming that an accepted image guarantees an accepted execution configuration.
Secrets provide the clearest before-and-after comparison. Before migration, an application might get a credential through a plain environment variable or an image layer. After migration to Docker Sandboxes, both local and cloud, a network proxy inserts the secret as an authentication header only when the hostname matches. The agent never sees the raw credential. The change moves authentication out of the agent’s environment and into a runtime-controlled path.
Document outbound dependencies so they can become an explicit allowlist, and remove assumptions that unrestricted outbound routes will be available. The runtime enforces deny-by-default egress. Base images, installed packages, and pinned dependencies stay as they are. Volume mount definitions continue to describe persistent workspace data, while Docker-native runtimes consume port mappings and service dependencies expressed in docker-compose.yml.
Packaging the extended image: OCI compatibility and the Kits specification
Once the environment’s assumptions are explicit, package its access requirements with it. Docker’s Kits specification v3 defines network permissions, credential proxies, volume mounts, port mappings, and skills paths inside a standard OCI image. These attributes form the packaging checklist. They let the rules travel with the agent rather than reside only in external configuration, while the runtime remains responsible for enforcing them.
For a Docker Cloud Sandboxes deployment, author a Kits v3 manifest that declares network permissions, credential proxy rules, and volume mounts as requests with deny-by-default semantics. Include the port mappings and skills paths that describe the packaged environment. Packaging a permission request makes the requirement available with the image. It does not turn the image into the isolation boundary.
OCI compatibility preserves the image’s usefulness beyond that deployment. The packaged image can be pulled and run on any OCI-compliant runtime, so the packaging investment is not specific to one runtime. If a runtime accepts the artifact, does it also support every access-control rule? That is a separate runtime-evaluation question. Kits also integrates with MCP, the Model Context Protocol, through a gateway for registering MCP servers and connecting them to sandboxed agents, which brings external tool access into the migration plan.
Adding statefulness: what Dockerfile volumes give you and where they stop
A persistent volume can make an agent look stateful. It preserves filesystem data across container restarts, but it does not prove which tool call ran, which side effect was committed, or whether retrying an action would duplicate destructive work. This is the gap between data persistence and durable execution. A workspace can survive even when the system lacks a safe point from which to resume the task.
To make work safe to resume, record the execution boundaries. Those records hold the model response used to make a decision, the exact tool input, the result receipt, and any approval decision. After a crash, the agent needs a known boundary rather than an attempt to reconstruct safe work from logs.
Conversation history, task records, and approval decisions belong in the relational database, while semantic memory and RAG belong in the vector store. Filesystem snapshots serve the workspace and intermediate build artifacts. These layers complement volume mounts, but their execution semantics must be added explicitly. With that extra wiring, checkpointing and any supported forking have an execution boundary from which work can resume, along with a copy of persistent files.
Choosing a runtime that accepts your existing Docker assets
Runtime evaluation should begin with the assets being migrated. Does the runtime accept a standard OCI image as the execution environment? Does it have microVM or the same level of kernel-level isolation, or does it offer only container isolation? Stateful execution with explicit checkpointing is a separate requirement, as is the choice between customer-managed compute and a vendor’s cloud. A match on image format does not settle the other questions.
Cloud Sandboxes combines microVM isolation with a kernel per sandbox, proxy-based secrets injection, and built-in MCP gateways. Kits v3 launched with it as a companion open specification. Its managed capacity is one to 16 vCPUs. It is designed to run the same workload locally or in the cloud under the same controls without changes, making local-to-cloud consistency a concrete evaluation point.
Hyperscaler managed runtimes offer another fit for existing Docker-based workloads. AWS Bedrock AgentCore, Google Vertex AI Agent Engine, and Azure AI Foundry Agent Service provide managed session isolation, long-running state, and framework-agnostic orchestration. They fit teams that already work within a single cloud provider’s ecosystem. The question for such a team is how its existing environment and state requirements fit that managed service.
Framework-native options place the boundary elsewhere. LangGraph Platform, OpenAI Agents SDK, CrewAI, and Dapr Agents add persistence and checkpointing at the agent layer while requiring the team to supply the execution environment. The existing Dockerfile is an input to that arrangement. Persistence at the framework layer therefore does not remove the need to evaluate the isolation and controls supplied by the environment underneath it.
Security and compliance requirements that the runtime layer must satisfy, not the image
Even a well-hardened image can fall short of what buyers require. The runtime layer must have network egress controls, secrets injection that does not expose credentials, kernel-level isolation against container escape, and audit trails of what the agent does. Those audit trails must support the availability and security trust service criteria that apply. Cloud Sandboxes’ deny-by-default egress, proxy-based credential injection, and hardware-level kernel isolation illustrate controls that a Dockerfile cannot replicate.
SOC 2 Type II provides a meaningful baseline for a runtime provider. It tells buyers that the vendor’s internal controls were independently audited over a defined period. Teams must separately check how model providers handle data and whether agent action logs meet a given regulator’s audit requirements. For a HIPAA review, for example, the model endpoints handling data cannot be treated as covered merely because the runtime provider has an audit.
Customer-facing behavior introduces a different requirement. The European Commission’s official FAQ states that EU AI Act Article 50 applies from August 2, 2026, to direct interaction with natural persons, subject to the exception where the AI nature of the interaction is obvious. A customer-facing agent’s runtime must therefore support the applicable disclosure at conversation start. Systems operating only in the background or through machine-to-machine communication fall outside that direct-interaction obligation. Neither image hardening nor an isolation boundary substitutes for the required disclosure.
A step-by-step migration path from existing Dockerfile to running agent sandbox
First, audit the Dockerfile and its execution configuration. Remove privileged flags, host-network mode, and seccomp profiles that depend on a shared kernel. Find credentials baked into image layers or passed through plain environment variables, and list all outbound network dependencies. The output is a bounded migration inventory. It shows which environment requirements stay and which launch assumptions must change.
Second, plan the state architecture before writing agent code. Assign conversation history, task records, and approval decisions to the relational database, semantic memory and RAG to the vector store, and workspace data and intermediate build artifacts to filesystem snapshots. In docker-compose.yml, add named volumes for each layer that must keep its data. Do not rely on restart behavior for durability. Use the execution boundaries described earlier to tell which data survived and which work can resume.
Third, package the image with its access rules. For Cloud Sandboxes, author a Kits v3 manifest declaring network permissions, credential proxy rules, and volume mounts as requests with deny-by-default semantics. For an OCI-compatible target, verify OCI conformance before pushing the artifact. Keep packaging and runtime support distinct. The earlier packaging section defines what the image includes and what still requires enforcement.
Fourth, set up secrets injection in the runtime layer. Remove raw credential references from the image and docker-compose.yml, then configure the runtime’s credential proxy or secrets manager to inject authentication headers only for matching hostnames. Authentication should no longer depend on exposing credentials to the agent.
Fifth, test isolation before connecting production tools. Start with a deny-all egress policy, add the explicit endpoint allowances, and verify that only allowed endpoints are reachable. Then kill and restart the sandbox. Confirm that execution resumes from the last recorded boundary.
Sixth, validate the runtime’s compliance documentation and applicable behavior. Confirm SOC 2, HIPAA, and GDPR coverage from provider documentation. For a customer-facing agent, check that any Article 50 disclosure that applies takes place when the conversation starts. This final gate tests the runtime’s responsibilities, leaving the Dockerfile to do its original job of defining a reproducible environment.


