A snapshot is a capture of the memory and disk of a running sandbox, saved under a name. A sandbox restored from a snapshot resumes the captured processes and memory instead of booting. Deleting the source sandbox does not affect its snapshots.
A Linux sandbox produces a full snapshot, and only a sandbox served from a warm template can be captured. A snapshot restores only in its home region, on the runner that captured it. macOS sandboxes do not produce these snapshots: a macOS filesystem snapshot saves the disk of a stopped persistent sandbox as an image, and it restores on any Mac of the region.
A snapshot holds a running state. To save only the filesystem of a sandbox, capture an image instead. To register a registry image or a Dockerfile build under a name, pull or build an image.
Concept
Description
Full snapshot
Kind full. The memory and disk of a running Linux sandbox that is served from a warm template.
Restore
A new sandbox that resumes the captured processes and memory, with the CPU, memory, and disk of the source.
Home region
The region of the source sandbox. A snapshot restores only there, on the runner that captured it.
Name
Unique in the project. Snapshots and images share one name space.
Snapshots are used when a new sandbox must continue from a running state instead of booting and repeating its setup.
Checkpoints of running work: a full snapshot saves the memory and disk of a running sandbox. A restore resumes the captured processes instead of starting them again.
Fast starts for slow-booting programs: a full snapshot taken after a server, a kernel, or a model has loaded restores with that program already running. New sandboxes skip the load time.
Evaluation and reinforcement learning (RL): each test case or episode resumes from the same snapshot. Results do not depend on another run.
Parallel attempts from one state: several sandboxes restore from the same snapshot, and each continues on its own. An agent tries several approaches from one point without repeating the setup.
Debugging and reproduction: a snapshot captures a sandbox in the state where a problem occurs. A restored sandbox reproduces that state, with its processes and memory, for inspection.
State that outlives the sandbox: deleting the source sandbox does not affect its snapshots. The sandbox is deleted to free its resources, and its state is restored later in its home region.
Create a snapshot of a running sandbox. The capture runs in the background: the snapshot starts as pending and becomes ready when the capture finishes.
Sets the snapshot name, 1 to 128 characters of letters, digits, ., _, and -. Snapshots and images in the project share one name space. A name in use fails with 409. This parameter is required.
The response has the following fields:
Field
Description
status
The status is pending, because the call returns once the capture is queued. To wait, call daytona.v2.snapshots.get(snapshot.id, wait="ready"). It returns at ready or failed, or after the server wait. The server wait is 30 seconds by default, and timeout sets it in seconds, up to 60.
The sandbox must be running.
On a Linux sandbox, this call captures kind full, which requires a sandbox served from a warm template.
import { Daytona } from '@daytona/sdk'
constdaytona=newDaytona()
// Snapshot capture needs a sandbox served from a warm template (see the notes)
Sets the snapshot name, 1 to 128 characters of letters, digits, ., _, and -. Snapshots and images in the project share one name space. A name in use fails with 409. This parameter is required.
The response has the following fields:
Field
Description
status
The status is pending, because the call returns once the capture is queued. To wait, call daytona.v2.snapshots.get(snapshot.id, { wait: 'ready' }). It returns at ready or failed, or after the server wait. The server wait is 30 seconds by default, and timeout sets it in seconds, up to 60.
The sandbox must be running.
On a Linux sandbox, this call captures kind full, which requires a sandbox served from a warm template.
Terminal window
daytonasnapshotcreate{sandboxId}--namemy-snapshot
Flag
Type
Description
--name
string
Sets the snapshot name. This flag is required.
--timeout
string
Sets how long the command waits for the snapshot to be ready. The default is 10m.
--no-wait
boolean
Returns once the capture is queued, without waiting for ready.
The command exits with an error if the capture fails.
The status is pending. To wait, call GET /snapshots/{snapshotId}?wait=ready&timeout_ms=60000. It answers 200 at ready or failed, or when the wait expires. timeout_ms defaults to 30000 and is at most 60000.
The sandbox must be running.
On Linux, the call captures only a sandbox served from a warm template.
Kind
Captures
Restore behavior
full
Memory and disk of a Linux sandbox
Resumes the captured processes and memory. Requires a sandbox served from a warm template. Pinned to the region and to the runner that captured it.
Status
Meaning
pending
Accepted; the capture job is queued on the sandbox’s runner.
capturing
The runner is pausing, copying, and packing the sandbox state.
ready
Restorable.
failed
Terminal. error carries the reason. The source sandbox keeps running.
Restore a sandbox from a snapshot. It resumes the captured processes and memory and keeps the source sandbox’s CPU, memory, and disk. A snapshot restores only in its home region, on the runner that captured it, and fails while that runner is unavailable.