Skip to content

Sandboxes

Concepts explain how Cere’s compute works: sandboxes, what they reserve and bill, egress and credentials, agents, and usage. The guides show how to use each.

A sandbox is a gVisor container on a node of the cluster. You create it from an image in a public registry, run commands in it, copy files in and out, and terminate it. Your bucket pays for what it reserves while it runs.

A sandbox runs any image from a public registry: Docker Hub (short names such as python:3.12-slim included), ghcr.io, quay.io or public.ecr.aws, up to 4096 MiB. Private registries are not supported. Devnet’s nodes are x86-64 and arm64; use an image built for both, as most official images are. An image with no build for its node’s platform fails with failed: image pull image has no build for this node's platform.

The sandbox’s main process is the command you give, or sleep infinity by default, so the sandbox waits for you to run commands in it. A command you give replaces the image’s entrypoint as well as its command.

Status Meaning
starting Placed on a node; the image is being pulled and the container started. The CLI and the SDK wait until it runs.
running The main process runs. You can run commands, copy files and read its logs.
terminated It ran and has ended; exit_reason says why. Final.
failed It never ran: no node took it, or the image pull, create or start failed. Final.
unknown Its node has been silent for more than 5 minutes. Not final: when the node reports again, the sandbox shows its real status.

Every sandbox that ends records an exit reason:

Exit reason Why
terminated by API or terminated by API: <reason> You terminated it, with an optional reason of up to 120 characters.
timeout (Ns) It reached its timeout.
idle_timeout (Ns) No command and no file call ran for its idle timeout.
exited with code N Its main process ended by itself.
oom_killed It needed more memory than it reserved.
token_expiry It reached 60 seconds before the expiry of the login it was created with.
disk_limit (N MiB), disk_limit (node disk is low) It wrote more than it may, or its node ran short of disk and it was using the most.
failed: image pull ..., failed: create ..., failed: start ... It never ran (status failed).
lost: runtime restarted, lost: host restarted Its node lost it.

Timeouts. A sandbox runs until its timeout (600 seconds unless you set one, at most 86400 seconds, 24 hours) or until you terminate it. An idle timeout, off by default, ends it sooner when nobody uses it: idle means no command and no file call in progress. A sandbox also ends 60 seconds before the login it was created with expires, so every usage record is signed while that login is valid, and a create with 60 seconds or less left on the login is refused. After cere login again, new sandboxes get the new login’s expiry.

After the end. Nothing is billed once the sandbox has stopped. Its logs stay readable for 10 minutes. Files you name when you terminate it (--retain) stay readable for 24 hours: up to 16 MiB each and 64 MiB for your bucket on that node, kept together or not at all.

  • Its own kernel. gVisor serves the sandbox’s system calls with a kernel of its own, in user space, so code in the sandbox does not run against the node’s kernel. Its processes cannot gain new privileges, and its CPU, memory and process count are capped at what you asked for.
  • No inbound network. A sandbox has no public address and publishes no port. You reach it only through the API: commands, files and logs.
  • Outbound only through the egress proxy. A sandbox reaches only the hosts its egress rules allow, through the cluster’s egress proxy, which adds the credentials those rules name. It has no DNS of its own: programs reach hosts through the proxy, which resolves the names. See Egress and credentials.

The working directory is /workspace unless you set another. The environment is the variables you pass (not secret: they stay on the node, and only their names are reported back), then the ones the cluster sets, which win:

Variable Value
HTTPS_PROXY, HTTP_PROXY (and lower case) The egress proxy, as the sandbox reaches it.
NO_PROXY (and lower case) localhost,127.0.0.1
SSL_CERT_FILE, REQUESTS_CA_BUNDLE, CURL_CA_BUNDLE, NODE_EXTRA_CA_CERTS, GIT_SSL_CAINFO /etc/ddc/egress-ca.crt, the egress proxy’s CA
DDC_SANDBOX_ID The sandbox’s id.

The egress proxy re-signs every TLS connection with that CA, and these variables make Python, curl, Node.js and git trust it. A program that verifies against its own set of roots (httpx with certifi, Java, Go with pinned roots) must add /etc/ddc/egress-ca.crt itself.

Limit
CPU More than 0 and at most 4 vCPU, in thousandths; default 1
Memory 128 to 8192 MiB; default 1024
Processes 1 to 32768; default 2048
Timeout 1 to 86400 seconds; default 600
Disk the sandbox writes 2048 MiB
Live sandboxes per bucket 20 (more answer 409 limit_active_sandboxes)
One file copied in or out 16 MiB
One command 1 hour
Commands, file and log calls in progress at once 8 per sandbox (more answer 429)
Environment 128 variables, 64 KiB
Labels 32; keys [a-z0-9._/-], up to 63 characters; values up to 256 characters; the cere. prefix is reserved for agent runs
GPU None