Skip to content
Dashboard

Run Docker containers inside Vercel Sandbox

Software Engineer, Compute

Update (August 2026): Vercel Sandbox now runs on Vercel Managed Images. Starting with SDK v3, new sandboxes default to the Ubuntu-based vercel/sandbox/universal:latest, where dnf isn't available. The example below applies to the deprecated Amazon Linux runtimes; on Ubuntu, install Docker with apt-get. See the announcement for details.

Vercel Sandbox now supports installing and running Docker inside a sandbox. An agent can build containers, install system packages, and modify files without touching your host system.

Install Docker, start the daemon, and serve a containerized application:

import { Sandbox } from "@vercel/sandbox";
const sandbox = await Sandbox.create();
await sandbox.runCommand({
sudo: true,
cmd: "dnf",
args: ["install", "-y", "docker"]
});
// Start docker daemon and wait for it to be ready
await sandbox.runCommand({ sudo: true, cmd: "dockerd", detached: true });
await sandbox.runCommand({
cmd: "sh",
args: [ "-lc", "until sudo docker info >/dev/null 2>&1; do sleep 1; done"]
});
await sandbox.runCommand({
cmd: "docker",
args: [
"run", "--rm", "-d",
"--name", "redis",
"redis:alpine"
]
});
await sandbox.runCommand({
cmd: "docker",
args: ["exec", "redis", "redis-cli", "PING" ]
});

Docker in a Sandbox is useful for running containerized services like Redis or Postgres as test dependencies, validating container images before deploying, or previewing applications served from a container. Combined with persistent sandboxes, the Docker installation and pulled images carry over between sessions.

As well as adding support for Docker, sandboxes now support FUSE filesystem drivers and VPN clients, unlocking unlimited capabilities to what can be built.

Learn more about these new system specifications in the documentation.