Skip to content

Snapshots

View as Markdown

Snapshots are reusable sandbox templates that provide a consistent and reproducible environment for your dependencies, settings, and resources.

A snapshot defines the base operating system, language runtimes, system packages, and project-level setup that should exist when a sandbox starts. Instead of repeating bootstrap steps on every sandbox creation, you capture that setup once as a snapshot and reuse it.

You start with default snapshots for common stacks, or create custom snapshots for your own toolchain and constraints. Custom snapshots are useful when your workflow depends on specific package versions, private dependencies, startup scripts, or filesystem layout. A snapshot created for one sandbox class cannot create a sandbox of the other class.

Daytona provides default snapshots with fixed resource sizes for creating sandboxes.

SnapshotvCPUMemoryStorageGPUSandbox Class
daytona-small11GiB3GiBContainer
daytona-medium24GiB8GiBContainer
daytona-large48GiB10GiBContainer
daytona-gpu11GiB1GiB1GPU
daytona-vm-small11GiB3GiBLinux VM
daytona-vm-medium24GiB8GiBLinux VM
daytona-vm-large48GiB10GiBLinux VM
windows-small14GiB30GiBWindows
windows-medium28GiB50GiBWindows
windows-large416GiB50GiBWindows
  1. Go to Daytona Sandboxes ↗
  2. Click Create Sandbox
  3. Select a snapshot
  4. Click Create
from daytona import Daytona, CreateSandboxFromSnapshotParams
daytona = Daytona()
sandbox = daytona.create(
CreateSandboxFromSnapshotParams(
snapshot="daytona-small",
)
)

Default snapshots include pre-installed Python and Node.js packages.

Python packages (pip)
PackageVersion
anthropicv0.76.0
beautifulsoup4v4.14.3
claude-agent-sdkv0.1.22
openai-agentsv0.15.1
daytonav0.134.0
djangov6.0.1
flaskv3.1.2
huggingface-hubv0.36.0
instructorv1.14.4
kerasv3.13.0
langchainv1.2.7
llama-indexv0.14.13
matplotlibv3.10.8
numpyv2.4.1
ollamav0.6.1
openaiv2.33.0
opencv-pythonv4.13.0.90
pandasv2.3.3
pillowv12.1.0
pipxv1.8.0
pydantic-aiv1.47.0
python-lsp-serverv1.14.0
requestsv2.32.5
scikit-learnv1.8.0
scipyv1.17.0
seabornv0.13.2
sqlalchemyv2.0.46
torchv2.10.0
transformersv4.57.6
uvv0.9.26
Node.js packages (npm)
PackageVersion
@anthropic-ai/claude-codev2.1.19
@openai/codexv0.128.0
bunv1.3.6
openclawv2026.2.1
opencode-aiv1.1.35
ts-nodev10.9.2
typescriptv5.9.3
typescript-language-serverv5.1.3

Create a snapshot.

  1. Go to Daytona Snapshots ↗

  2. Click Create Snapshot

  3. Enter the snapshot name and image

    • Snapshot name: identifier used to reference the snapshot
    • Snapshot image: base image for the snapshot, must include either a tag or a digest (e.g., ubuntu:22.04); the latest/lts/stable tags are not supported
  4. Click Create

from daytona import Daytona, CreateSnapshotParams
daytona = Daytona()
snapshot = daytona.snapshot.create(
CreateSnapshotParams(name="my-awesome-snapshot", image="ubuntu:22.04"),
)

Create a GPU snapshot. GPU snapshots are used to create GPU sandboxes.

  1. Go to Daytona Snapshots ↗

  2. Click Create Snapshot

  3. Enter the snapshot name and image

  4. Select the Allocate GPU checkbox

  5. Specify the GPU type(s):

    • NVIDIA H100
    • NVIDIA H200
    • NVIDIA RTX PRO 6000
    • NVIDIA RTX 4090
    • NVIDIA RTX 5090
  6. Click Create

from daytona import CreateSnapshotParams, Daytona, Image, Resources
daytona = Daytona()
snapshot = daytona.snapshot.create(
CreateSnapshotParams(
name="my-gpu-snapshot",
image=Image.base("python:3.12"),
resources=Resources(cpu=1, memory=1, disk=1, gpu=1),
),
)

Daytona provides methods to create VM snapshots for Linux and Windows.

VM snapshots are used to create VM sandboxes. VM snapshots are distinct from container snapshots and cannot be used to create container sandboxes. VM snapshots support VM-only capabilities such as creating hot/cold snapshots from sandboxes.

Create a Linux VM snapshot.

  1. Create a snapshot from a base image
  2. Set the snapshot’s sandbox class to LINUX_VM
from daytona import Daytona, CreateSnapshotParams, SandboxClass
daytona = Daytona()
snapshot = daytona.snapshot.create(
CreateSnapshotParams(
name="my-vm-snapshot",
image="ubuntu:22.04",
sandbox_class=SandboxClass.LINUX_VM,
)
)

Windows VM snapshots are used to create Windows VM sandboxes. They cannot be created from a base image. They are produced only through the snapshot from sandbox by starting from an existing Windows sandbox and capturing its current state as a snapshot.

Create a snapshot from any publicly accessible image or container registry.

  1. Go to Daytona Snapshots ↗
  2. Click the Create Snapshot button
  3. Enter the snapshot name and image of any publicly accessible image or container registry
from daytona import Daytona, CreateSnapshotParams
daytona = Daytona()
daytona.snapshot.create(
CreateSnapshotParams(name="my-awesome-snapshot", image="python:3.11-slim"),
on_logs=lambda chunk: print(chunk, end=""),
)

Create a snapshot from local images or from local Dockerfiles.

Daytona expects the local image to be built for AMD64 architecture. Therefore, the --platform=linux/amd64 flag is required when building the Docker image if your machine is running on a different architecture.

  1. Ensure the image and tag you want to use is available
Terminal window
docker images
  1. Create a snapshot and push it to Daytona:
Terminal window
daytona snapshot push custom-alpine:3.21 --name alpine-minimal

Alternatively, use the --dockerfile flag under create to pass the path to the Dockerfile you want to use and Daytona will build the snapshot for you. The COPY/ADD commands will be automatically parsed and added to the context. To manually add files to the context, use the --context flag.

Terminal window
daytona snapshot create my-awesome-snapshot --dockerfile ./Dockerfile

Create a snapshot from images from private container registries.

  1. Go to Daytona Registries ↗

  2. Click Add Registry and select your provider:

  3. Enter the required fields

  4. Go to Daytona Snapshots ↗

  5. Click Create Snapshot

  6. Enter the snapshot name and the full image reference, including the registry host and repository (e.g. my-registry.com/<repo>/custom-alpine:3.21)

Create a snapshot from Docker Hub images.

  1. Go to Daytona Registries ↗

  2. Click Add Registry and select the Docker Hub tab

  3. Input the following fields:

    • Username: your Docker Hub username (the account with access to the image)
    • Personal Access Token: a Docker Hub PAT; not your account password
    • Registry URL: auto-filled with docker.io and not shown in the form
  4. Create the snapshot using the full image reference

    docker.io/<username>/<image>:<tag>

Create a snapshot from images from Google Artifact Registry.

  1. Go to Daytona Registries ↗,

  2. Click Add Registry and select the Google tab

  3. Input the following fields:

    • Registry URL: the base URL for your region

      https://<region>-docker.pkg.dev

    • Service Account JSON Key: the contents of your service account key JSON file

    • Google Cloud Project ID: your GCP project ID

    • Username: auto-filled with _json_key (required by Google for service-account auth)

  4. Create the snapshot using the full image reference

    <region>-docker.pkg.dev/<project>/<repo>/<image>:<tag>

Create a snapshot from images from GitHub Container Registry.

  1. Go to Daytona Registries ↗,

  2. Click Add Registry and select the GitHub tab

  3. Input the following fields:

    • GitHub Username: the account with access to the image
    • Personal Access Token: a GitHub PAT with read:packages scope (and write:packages / delete:packages for pushing or deleting)
    • Registry URL: auto-filled with ghcr.io and not shown in the form
  4. Create the snapshot using the full image reference

    ghcr.io/<owner>/<image>:<tag>

Create a snapshot from images from Amazon Elastic Container Registry.

Daytona pulls private ECR images via cross-account IAM role assumption. You create a role in your AWS account that trusts Daytona’s broker principal, and Daytona assumes it on every pull to fetch a short-lived ECR token.

  • Daytona Broker ARN

    The IAM principal Daytona uses to assume into your role. Self-hosted: substitute the IAM role your API pods assume (e.g. via IRSA).

    arn:aws:iam::967657494466:role/DaytonaEcrCredentialBroker

  • External ID

    Your Daytona organization ID, visible in the dashboard URL (/dashboard/<orgId>/...) and on your organization settings page.

  1. Create an IAM role in your AWS account

    • Trust policy
    {
    "Version": "2012-10-17",
    "Statement": [{
    "Effect": "Allow",
    "Principal": { "AWS": "arn:aws:iam::967657494466:role/DaytonaEcrCredentialBroker" },
    "Action": "sts:AssumeRole",
    "Condition": {
    "StringEquals": {
    "sts:ExternalId": "<YOUR_EXTERNAL_ID>"
    }
    }
    }]
    }
    • Permissions policy (read-only on ECR)
    {
    "Version": "2012-10-17",
    "Statement": [{
    "Effect": "Allow",
    "Action": [
    "ecr:GetAuthorizationToken",
    "ecr:BatchCheckLayerAvailability",
    "ecr:GetDownloadUrlForLayer",
    "ecr:BatchGetImage"
    ],
    "Resource": "*"
    }]
    }
  2. Go to Daytona Registries ↗

  3. Click Add Registry and select the Amazon ECR tab

  4. Input the following fields:

    • Registry URL: <account_id>.dkr.ecr.<region>.amazonaws.com
    • Role ARN: the role you created in step 1

    Password is not used for ECR. Daytona resolves credentials server-side by assuming the role you created in step 1, using your organization ID as the AssumeRole ExternalId.

  5. Go to Daytona Snapshots ↗

  6. Click Create Snapshot

  7. Enter the snapshot name and the full image reference

    <account_id>.dkr.ecr.<region>.amazonaws.com/<repo>/<image>:<tag>

  8. (Optional) Harden the trust policy

    Daytona sends a daytona-<orgId>-pull session name on every AssumeRole call. You can require it in your trust policy for CloudTrail audit visibility. Add inside Condition:

    "StringLike": {
    "sts:RoleSessionName": "daytona-<YOUR_EXTERNAL_ID>-*"
    }

Get a snapshot by name.

daytona.snapshot.get("my-awesome-snapshot")

List snapshots and view their details.

daytona.snapshot.list(page=2, limit=10)

Activate an inactive snapshot.

Snapshots automatically become inactive after 2 weeks of not being used.

  1. Go to Daytona Snapshots ↗
  2. Click the three dots at the end of the row for the snapshot you want to activate
  3. Click the Activate button
daytona.snapshot.activate("my-awesome-snapshot")

Deactivate a snapshot.

Deactivated snapshots are not available for new sandboxes.

  1. Go to Daytona Snapshots ↗
  2. Click the three dots at the end of the row for the snapshot you want to deactivate
  3. Click the Deactivate button

Delete a snapshot.

Deleted snapshots cannot be recovered.

  1. Go to Daytona Snapshots ↗
  2. Click the three dots at the end of the row for the snapshot you want to delete
  3. Click the Delete button
daytona.snapshot.delete(daytona.snapshot.get("my-awesome-snapshot"))

A snapshot can have several different states. Each state reflects the snapshot’s current status.

  • Pending: the snapshot creation has been requested
  • Building: the snapshot is being built
  • Pulling: the snapshot image is being pulled from a registry
  • Active: the snapshot is ready to use for creating sandboxes
  • Inactive: the snapshot is deactivated; must be explicitly activated before use
  • Error: the snapshot creation failed
  • Build Failed: the snapshot build process failed
  • Removing: the snapshot is being deleted

Sandboxes can run Docker containers inside them (Docker-in-Docker), enabling you to build, test, and deploy containerized applications.

Agents can interact with these services since they run within the same sandbox environment, providing better isolation and security compared to external service dependencies.

  • Run databases (PostgreSQL, Redis, MySQL) and other services
  • Build and test containerized applications
  • Deploy microservices and their dependencies
  • Create isolated development environments with full container orchestration

Daytona provides an option to create a snapshot with Docker support using pre-built Docker-in-Docker images as a base or by manually installing Docker in a custom image.

The following base images are widely used for creating Docker-in-Docker snapshots or can be used as a base for a custom Dockerfile:

  • docker:28.3.3-dind: official Docker-in-Docker image (Alpine-based, lightweight)
  • docker:28.3.3-dind-rootless: rootless Docker-in-Docker for enhanced security
  • docker:28.3.2-dind-alpine3.22: Docker-in-Docker image with Alpine 3.22

Manual installation

Alternatively, install Docker manually in a custom Dockerfile:

FROM ubuntu:22.04
# Install Docker using the official install script
RUN curl -fsSL https://get.docker.com | VERSION=28.3.3 sh -

Define and run multi-container applications. With Docker-in-Docker enabled in a Daytona sandbox, you can use Docker Compose to orchestrate services like databases, caches, and application containers.

  1. Create a Docker-in-Docker snapshot with one of the pre-built images
  2. Run Docker Compose services inside a sandbox
from daytona import Daytona, CreateSandboxFromSnapshotParams
# Initialize the Daytona client
daytona = Daytona()
# Create a sandbox from a Docker-in-Docker snapshot
sandbox = daytona.create(CreateSandboxFromSnapshotParams(snapshot='docker-dind'))
# Create a docker-compose.yml file
compose_content = '''
services:
web:
image: nginx:alpine
ports:
- "8080:80"
'''
sandbox.fs.upload_file(compose_content.encode(), 'docker-compose.yml')
# Start Docker Compose services
result = sandbox.process.exec('docker compose -p demo up -d')
print(result.result)
# Check running services
result = sandbox.process.exec('docker compose -p demo ps')
print(result.result)
# Clean up
sandbox.process.exec('docker compose -p demo down')

Sandboxes can run a Kubernetes cluster inside the sandbox. Kubernetes runs entirely inside the sandbox and is removed when the sandbox is deleted, keeping environments secure and reproducible.

The snippet installs and starts a k3s cluster inside a sandbox and lists all running pods:

import { Daytona } from '@daytona/sdk'
import { setTimeout } from 'timers/promises'
// Initialize the Daytona client
const daytona = new Daytona()
// Create the sandbox instance
const sandbox = await daytona.create()
// Run the k3s installation script
const response = await sandbox.process.executeCommand(
'curl -sfL https://get.k3s.io | sh -'
)
// Run k3s
const sessionName = 'k3s-server'
await sandbox.process.createSession(sessionName)
const k3s = await sandbox.process.executeSessionCommand(sessionName, {
command: 'sudo /usr/local/bin/k3s server',
async: true,
})
// Give time to k3s to fully start
await setTimeout(30000)
// Get all pods
const pods = await sandbox.process.executeCommand(
'sudo /usr/local/bin/kubectl get pod -A'
)
console.log(pods.result)