Share feedback
Answers are generated based on the documentation.

sbx template save

DescriptionSave a snapshot of the sandbox as a template
Usagesbx template save SANDBOX TAG [flags]

Description

Save a sandbox snapshot as a template in the local image store. Use --pull never when creating a sandbox from the saved template.

The image the sandbox was created from must still be in the local image store. If it was removed, restore it first, for example with sbx template load.

Use --output to export a tar file for loading on another host with sbx template load.

With --cloud: Snapshot a running cloud sandbox into a cloud-managed template. The snapshot can take several minutes for kit-sized images; the command polls for completion. Use --description to attach a free-form description to the saved template.

--capture-mode controls what gets captured: "disk" (default) cold-boots from the filesystem; "all" captures memory + disk + microVM checkpoint so subsequent runs resume in sub-second time at the cost of a slower load.

Cloud snapshots typically produce multi-GB templates and take several minutes to complete. See https://docs.docker.com/ai/sandboxes/ for the snapshot/load model.

Options

OptionDefaultDescription
--capture-modediskWhat gets captured for this template. "disk" (default) captures only the filesystem — cold-boot from a standard OCI image, faster load. "all" captures memory + disk + microVM checkpoint — sub-second TTI on resume, slower load. Only effective with --cloud.
--descriptionDescription for the template (cloud only)
-o, --outputAlso export the image to a tar file

Global options

OptionDefaultDescription
--cloudDispatch to Docker Cloud Sandboxes API instead of local sandboxd (supported by a growing set of verbs — run 'sbx --cloud --help' for the current list)
-D, --debugEnable debug logging
--no-inputNever prompt; commands that need an answer fail with the command to run instead

Examples

# Save as a template for new sandboxes on this host
sbx template save my-sandbox myimage:v1.0

# Create a sandbox from the saved template
sbx run --pull never -t myimage:v1.0 claude ./project

# Also export to a shareable tar file
sbx template save my-sandbox myimage:v1.0 --output /tmp/myimage.tar

# Cloud: snapshot a running cloud sandbox into a cloud-managed template
sbx --cloud template save sbx_abc123 my-snap

# Cloud: attach a description to the saved template
sbx --cloud template save sbx_abc123 my-snap --description "nightly build"

# Cloud: capture memory + disk + microVM checkpoint for sub-second resume
sbx --cloud template save sbx_abc123 my-snap --capture-mode all