Skip to content

Docker Sandbox

A sandbox is an isolated compute environment. Each sandbox has its own filesystem, network namespace, and configurable vCPU, memory, and disk. Sandboxes spin up in under 90ms and run any OCI-compatible image.

TypeRuntime valueDescription
Dockerdocker (default)Standard runc-backed containers. Works on any node.
gVisorgvisorUser-space kernel - intercepts syscalls. Better isolation, same hardware requirements. See gVisor Sandbox.
FirecrackerfirecrackerFull microVM - each sandbox boots its own kernel in under 100ms. Requires bare-metal nodes. See Firecracker Sandbox.
GPUdocker + gpus fieldStandard Docker with direct GPU passthrough. See GPU Sandbox.
created ──► running ──► stopped ──► running
destroyed
StateDescription
runningSandbox is up and accepting requests.
stoppedSandbox is paused; filesystem state is persisted.
destroyedSandbox and all its data are permanently removed.
import { MicroVM } from '@aerol-ai/aerolvm-sdk'
const client = new MicroVM({
apiUrl: process.env.SB_API_URL,
patToken: process.env.SB_PAT_TOKEN,
})
const sandbox = await client.create({
image: 'ubuntu:22.04',
cpu: 1,
memoryMB: 1024,
diskGB: 10,
lifecycle: {
stopIfIdleFor: 60 * 60 * 1_000_000_000, // 1 hour in nanoseconds
destroyAtAge: 24 * 60 * 60 * 1_000_000_000, // 24 hours in nanoseconds
},
})
console.log(sandbox.id)
console.log(sandbox.sshPrivateKey) // only returned by create()

Pass a name field to pin a human-readable identifier to the sandbox. Names must be unique — if you call create with a name that belongs to an existing sandbox, the daemon returns HTTP 409 Conflict with "sandbox name already in use". Omit the field (or leave it empty) to let the daemon generate a random ID.

Retrieve a running sandbox by ID to get a fully usable sandbox object.

const sandbox = await client.get('sbx_abc123')
console.log(sandbox.id)
console.log(sandbox.publicURL)

Stopping persists all container-level filesystem state. Starting resumes from the persisted layer - running processes are not retained across a stop/start cycle.

await sandbox.stop()
await sandbox.start()

Permanently removes the sandbox, all its data, and its metadata. External storage mounts are unmounted before removal.

await sandbox.destroy()

Change CPU or memory allocation on a running sandbox without restarting it.

await sandbox.resize({ cpu: 2, memoryMB: 2048 })
const sandboxes = await client.list()
const sandbox = await client.get(id)

Sandboxes can self-terminate based on age or inactivity. Lifecycle parameters can be updated at any time without restarting the sandbox.

await sandbox.updateLifecycle({
stopIfIdleFor: 2 * 60 * 60 * 1_000_000_000, // 2 hours
destroyAtAge: 48 * 60 * 60 * 1_000_000_000, // 48 hours
})

See Environment for image selection, environment variables, and resource defaults.