# Moving an agent's code runner from local Docker to a hosted microVM: a migration checklist

> What changes when your agent stops running code in a Docker container on your server and starts using a hosted microVM sandbox: images, files, network, secrets, timeouts, output, cost and cleanup. A checklist with the gotchas.

What changes when your agent stops running code in a Docker container on your server and starts using a hosted microVM sandbox: images, files, network, secrets, timeouts, output, cost and cleanup. A checklist with the gotchas.

November 26, 2026 · 4 min read · The Sandscale team

A lot of agents start the same way: `docker run --rm` on the server that runs the agent, with the model’s code mounted in. It works, until the agent runs code from strangers, or from a web page it read, and someone points out that the container shares the server’s kernel and probably its network. Moving to a hosted microVM fixes the boundary. It also changes a dozen small assumptions your code makes. This checklist is for finding them before production does.

## 1. The image

- **List what your Docker image installs.** System packages, language runtimes, tools the agent calls. A hosted sandbox starts from a template; check that one covers your needs or build your own.
- **Pin it.** Use a digest, not a tag, so two runs a week apart get the same environment.
- **Remove what the agent does not need.** Compilers, `ssh`, cloud CLIs. Every tool in the image is a tool a prompt injection can use.

On Sandscale, built-in templates include Python, Node and Go images (`builtin:python`, `builtin:node`, `builtin:go`), and templates are pinned by digest. `image` on create accepts an OCI image pinned by `name@sha256:...`.

## 2. Files in and out

- **Replace bind mounts.** Locally you mounted a directory; now files go in and out through the API. Decide what goes in (a few files, or the whole project) and what comes back (a diff, artifacts, nothing).
- **Stop relying on the host seeing changes live.** Read results back explicitly at the end of a step.
- **Check sizes.** Uploading a large repository per run is slow and wasteful; start from a snapshot with the repository already in place, or clone inside the box.

See [uploading a project into a sandbox](https://sandscale.dev/blog/uploading-a-project-into-a-sandbox).

## 3. Network

- **Find out what your container could reach.** With Docker’s default bridge network, the container usually had outbound internet and could often reach services on the host or the same network. List what the agent actually needs.
- **Start closed.** Default to no network, then allow package registries and the specific APIs a task needs.
- **Check DNS.** If DNS resolves everything, data can leave through lookups. See [DNS exfiltration](https://sandscale.dev/blog/dns-exfiltration-explained).
- **Remove access to internal services.** A hosted box will not be on your private network, which is the point. If a task needs an internal API, expose a narrow endpoint for it.

On Sandscale, sandboxes start with network mode `none`; `allowlist` uses your organization’s egress allowlist and package registry presets.

## 4. Secrets

- **Find every secret in the old setup.** `-e API_KEY=...` on `docker run`, mounted credential files, cloud instance credentials reachable from the container (the metadata endpoint is a classic).
- **Give each run only what its task needs,** scoped and short-lived.
- **Assume code in the box can read what you give it.** That does not change with a VM. See [secrets in environment variables](https://sandscale.dev/blog/secrets-in-environment-variables-risks).

On Sandscale, Vault hands secrets to a run in memory as environment variables and ends them with the run; values stay out of prompts, logs, the API’s answer and the audit log.

## 5. Timeouts and lifetimes

- **Map your old timeout to three.** `docker run` with `timeout` in front was one clock. Now there is the sandbox’s lifetime, each command’s limit, and your HTTP client’s timeout. See [three timeouts for agent sandboxes](https://sandscale.dev/blog/timeouts-for-agent-sandboxes).
- **Handle orphans.** `--rm` cleaned up when your process exited. A hosted box survives your process; set a lifetime so it does not survive forever.

## 6. Output and errors

- **Replace parsing of `docker` exit codes.** A hosted API returns structured results. On Sandscale, `run()` returns `exitCode`, `stdout`, `stderr`, `timedOut` and `oomKilled`.
- **Stream long commands** instead of waiting for the end. See [streaming sandbox output](https://sandscale.dev/blog/streaming-sandbox-output-typescript).
- **Handle API errors separately from command failures.** A 429 or a network error is not the model’s fault; retry it, do not report it. See [handling sandbox API errors](https://sandscale.dev/blog/handling-sandscale-api-errors-typescript).

## 7. Concurrency and cost

- **Check the provider’s limit on boxes at once** against your peak. Add a queue in front if needed. See [concurrency limits and queueing](https://sandscale.dev/blog/concurrency-limits-and-queueing-agent-runs).
- **Model cost from your real run shape:** how long boxes exist, how much of that they work, and what size. See [five ways agent sandboxes are billed](https://sandscale.dev/blog/agent-sandbox-billing-models-compared).
- **Right-size.** Your local container probably had the whole server. See [sizing a sandbox](https://sandscale.dev/blog/sizing-sandboxes-vcpu-memory).

## 8. Records

- **Label every box** with the task, user and agent, so you can trace it.
- **Decide what you log yourself and what the provider records.** On Sandscale, every sandbox and API call lands in a hash-chained audit log, on every plan.

## 9. Rollout

- **Run both side by side** for a while: same tasks, old runner and new, compare results.
- **Move the riskiest workloads first,** the ones that run code from outside sources, not the safest.
- **Keep the old path behind a flag** until the new one has handled a bad day.

## The gotcha list

Four that are easy to miss: a tool that silently needed network and now hangs; a test that wrote to `/tmp` on the host and read it back from the agent process; a secret that was in the image all along; and boxes left running after a deploy restarted the orchestrator. Each one is on the list above.

**On this page**

1. 1. The image
2. 2. Files in and out
3. 3. Network
4. 4. Secrets
5. 5. Timeouts and lifetimes
6. 6. Output and errors
7. 7. Concurrency and cost
8. 8. Records
9. 9. Rollout
10. The gotcha list

**Run your agents in a box of their own**

Each sandbox is a Firecracker microVM. Free includes 100 awake vCPU-hours a month.

[Start free](https://cloud.sandscale.dev/auth/signup)

## Keep reading

- [November 26, 2026 · **30 questions to ask any agent sandbox provider before you sign up** · A vendor-neutral checklist for choosing where your agents run code: isolation, network, secrets, lifecycle, billing for waiting time, governance, data location, reliability and leaving. With where to find each answer for Sandscale.](https://sandscale.dev/blog/questions-to-ask-an-agent-sandbox-provider)
- [November 26, 2026 · **Agent sandbox glossary: 41 terms in plain English** · Plain definitions for the words that come up when you run AI agent code in isolation: microVM, VMM, KVM, jailer, gVisor, seccomp, namespaces, egress allowlist, lease, snapshot, warm pool, awake vCPU-hour and more.](https://sandscale.dev/blog/agent-sandbox-glossary)

---
Source: https://sandscale.dev/blog/local-docker-to-hosted-microvm-checklist
