Platform

Sandbox templates

Define reusable Sandbox images with packages, a setup step, and private services.

View as Markdown

A Sandbox template is a reusable recipe for a Sandbox: a base image, a size, packages, one setup step, and the services it exposes. Templates belong to an organization and are managed with ccp apply.

Create a template

Write a manifest:

sandbox.yaml
apiVersion: sandboxes.clusterbase.ai/v1
kind: SandboxTemplate
metadata:
  name: python-tools
spec:
  base: debian
  resources:
    vcpu: 2
    memory_mb: 1024
  packages:
    apt: [jq, python3, python3-venv]
  ports:
    - name: cdp
      port: 9222
      protocol: websocket
  steps:
    - run: |
        python3 -m venv /opt/python
        /opt/python/bin/pip install cowsay==6.1
        mkdir -p /workspace

Apply it and wait for the build:

ccp apply --file sandbox.yaml --wait

Then launch Sandboxes from it:

ccp sandbox create --template python-tools --ttl 30m

Manifest reference

FieldRequiredDescription
metadata.nameYesTemplate name, unique in the organization. Used by --template.
spec.baseYesBase image. See Bases.
spec.resourcesYesvcpu and memory_mb. See Sizes.
spec.packagesNoPackage lists by manager: apt, apk, pip, npm, cargo, gem, go.
spec.portsNoUp to eight services. See Ports.
spec.stepsYesExactly one run script, executed after packages install.

Manifests can be YAML, JSON, or TOML (files ending in .toml are read as TOML). Unknown fields are rejected, so secrets, environment variables, and IDs can't be added to a manifest. Keep manifests safe to commit.

Bases

BasePackage managersNotes
debianaptMinimal. Install language runtimes yourself.
alpineapkMinimal. Install language runtimes yourself.
developmentaptThe built-in development image with its tools, idle pause, and public preview port.
browserapt, pip, npm, cargo, gem, goThe browser image managed agents use.
desktopaptThe built-in graphical desktop, with idle pause, the desktop viewer, and a public preview port.

A package list for a manager the base doesn't support is rejected before the build starts.

On development and desktop, a template with no spec.ports keeps the base's ports, and idle pause applies either way. Declaring any ports replaces the base's ports entirely, including the public preview service and, on desktop, the desktop viewer used by ccp sandbox desktop. On development and desktop, install other language packages in the run step.

Sizes

spec.resources must be one of these pairs:

vcpumemory_mb
1256
1512
21024
42048
44096

Ports

Each entry in spec.ports has:

FieldDescription
nameLowercase DNS label, unique in the template. Used by ccp sandbox connect.
portGuest port, unique in the template.
protocolhttp or websocket.

Declaring a port doesn't start anything: your setup must start the service and listen on the guest's network interface. Declared services are private; reach them with ccp sandbox connect.

Updates and builds

ccp apply is safe to repeat. An unchanged manifest reuses the existing build. Changing the base, resources, packages, ports, or setup step creates a new build; existing builds never change. New Sandboxes use the latest ready build. Sandboxes already running keep the build they started with.

FlagEffect
--dry-runShow what would change without writing anything.
--waitWait up to 30 minutes for the build to be ready. Progress goes to stderr. Exits nonzero if the build fails, is cancelled, or times out.
--jsonPrint the apply result as JSON. With --wait, it includes the final status.

Stopping --wait doesn't cancel the build. --wait can't be combined with --dry-run.

Manage templates in the console

Build → Sandboxes → Templates in the console lists your templates with their builds and build logs. Archive a template from its detail page when you no longer need it.

See ccp apply for every flag.

On this page