Skip to content

Snapshots

View as Markdown

Snapshots are sandbox templates created from Docker or OCI compatible images. Sandboxes can use a default snapshot or custom snapshots to provide a consistent and reproducible sandbox environments for your dependencies, settings, and resources.

Create Snapshots

Daytona provides options to create snapshots using public images, private images, local images, and the declarative builder.

  1. Navigate to Daytona Snapshots ↗
  2. Click the Create Snapshot button
  3. Enter the snapshot name, image (tag or digest), entrypoint, and resources
  • Snapshot name: Identifier used to reference the snapshot in the SDK or CLI
  • Image: Base image for the snapshot. Must include either a tag (e.g., ubuntu:22.04) or a digest. The latest tag is not allowed.
  • Entrypoint (optional): The entrypoint command for the snapshot. Ensure that the entrypoint is a long-running command. If not provided, or if the snapshot does not have an entrypoint, sleep infinity will be used as the default.
  • Resources (optional): The resources you want the underlying Sandboxes to have. By default, Daytona Sandboxes use 1 vCPU, 1GiB memory, and 3GiB storage.

For more information, see the Python SDK and TypeScript SDK references:

create (Python SDK)

create (TypeScript SDK)

Using public images

Daytona supports creating snapshots from public images from Docker Hub or other public container registries.

  1. Navigate to Daytona Snapshots ↗
  2. Click the Create Snapshot button
  3. Enter the snapshot name and image tag or digest of any publicly accessible image from Docker Hub or from another public container registry.

Once the snapshot is pulled, validated, and has an Active state, it is ready to be used.

Using local images

Daytona supports creating snapshots from local images or from local Dockerfiles. To create a snapshot from a local image or from a local Dockerfile, use the Daytona CLI.

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. For more information, see the CLI documentation.

  1. Run docker images to ensure the image and tag you want to use is available
  2. Run daytona snapshot push <your_local_docker_image> to create a snapshot and push it to Daytona, e.g.:
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 data-analysis01 --dockerfile ./Dockerfile
Building image from /Users/user/docs/Dockerfile
Step 1/5 : FROM alpine:latest
...
⡿ Waiting for the Snapshot to be validated ...
...
✓ Use 'harbor-transient.internal.daytona.app/daytona/trying-daytona:0.0.1' to create a new sandbox using this Snapshot

Using images from private registries

Daytona supports creating snapshots from images from Docker Hub, Google Artifact Registry, GitHub Container Registry or other private container registries.

  1. Navigate to Daytona Registries ↗
  2. Click the Add Registry button
  3. Enter the registry name, registry URL, username, password, and project (if applicable)
  4. After the container registry is successfully created, navigate to Daytona Snapshots ↗
  5. Click the Create Snapshot button
  6. Enter the snapshot name and private image tag or digest. When creating the snapshot, make sure to input the entire private image name, including the registry location and project name (e.g. my-private-registry.com/<my-project>/custom-alpine:3.21)

Optionally, set the CreateSandboxFromSnapshotParams field to use the custom snapshot.

Docker Hub

Daytona supports creating snapshots from Docker Hub images.

  1. Navigate to Daytona Registries ↗
  2. Click the Add Registry button
  3. Enter the registry name, registry URL, username, password, and project (if applicable)
  • Registry URL: docker.io
  • Username: Docker Hub username (the account with access to the image)
  • Password: Docker Hub Personal Access Token (not your account password)
  • Create the Snapshot: docker.io/<username>/<image>:<tag>
  1. After the container registry is successfully created, navigate to Daytona Snapshots ↗
  2. Click the Create Snapshot button
  3. Enter the snapshot name and image tag or digest. When creating the snapshot, input the entire image name, including the registry location and project name (e.g. docker.io/<username>/<image>:<tag>)

Google Artifact Registry

Daytona supports creating snapshots from images from Google Artifact Registry.

To use an image from Google Artifact Registry, configure the registry using a service account key in JSON format.

  1. Navigate to Daytona Registries ↗
  2. Click the Add Registry button
  3. Enter the registry name, registry URL, username, password, and project (if applicable)
  • Registry URL: base URL for your region (e.g., https://us-central1-docker.pkg.dev or https://us-central1-docker.pkg.dev/your-org).
  • Username: _json_key
  • Password: Paste the full contents of your Service Account JSON key file
  • Project: Google Cloud Project ID
  • Create the Snapshot: us-central1-docker.pkg.dev/<project>/<repo>/<image>:<tag>
  1. After the container registry is successfully created, navigate to Daytona Snapshots ↗
  2. Click the Create Snapshot button
  3. Enter the snapshot name and image tag or digest. When creating the snapshot, make sure to input the entire image name, including the registry location and project name (e.g. us-central1-docker.pkg.dev/<project>/<repo>/<image>:<tag>)

GitHub Container Registry (GHCR)

Daytona supports creating snapshots from images from GitHub Container Registry (GHCR).

  1. Navigate to Daytona Registries ↗
  2. Click the Add Registry button
  3. Enter the registry name, registry URL, username, password, and project (if applicable)
  • Registry URL: ghcr.io
  • Username: GitHub username (the account with access to the image)
  • Password: GitHub Personal Access Token (not your account password). Personal access token (PAT) requires write:packages, read:packages, and delete:packages scopes.
  1. After the container registry is successfully created, navigate to Daytona Snapshots ↗
  2. Click the Create Snapshot button
  3. Enter the snapshot name and image tag or digest. When creating the snapshot, make sure to input the entire image name, including the registry location and project name (e.g. ghcr.io/<my-project>/custom-alpine:3.21)

Using the declarative builder

Declarative Builder provides a code-first approach to define your snapshots.

Snapshot resources

Snapshots can be customized with specific resource requirements. By default, Daytona Sandboxes use 1 vCPU, 1GB RAM, and 3GiB disk. For more information, see sandbox resources.

To view your available resources and limits, see limits or navigate to Daytona Limits ↗.

Snapshot resources can be customized using the Resources class.

from daytona import (
Daytona,
CreateSnapshotParams,
Image,
Resources,
)
daytona = Daytona()
# Create a snapshot with custom resources
daytona.snapshot.create(
CreateSnapshotParams(
name="my-snapshot",
image=Image.debian_slim("3.12"),
resources=Resources(
cpu=2,
memory=4,
disk=8,
),
),
on_logs=print,
)

For more information, see the Python SDK and TypeScript SDK references:

CreateSnapshotParams (Python SDK)

CreateSnapshotParams (TypeScript SDK)

Get a Snapshot by name

Daytona provides an option to get a snapshot by name.

The following snippet returns the snapshot with the specified name:

daytona = Daytona()
snapshot = daytona.snapshot.get("my-awesome-snapshot")
print(f"{snapshot.name} ({snapshot.image_name})")

For more information, see the Python SDK and TypeScript SDK references:

get (Python SDK)

get (TypeScript SDK)

List Snapshots

Daytona provides options to list snapshots and view their details.

The following snippet lists all snapshots on the first page with a limit of 10 snapshots per page.

daytona = Daytona()
result = daytona.snapshot.list(page=2, limit=10)
for snapshot in result.items:
print(f"{snapshot.name} ({snapshot.image_name})")

For more information, see the Python SDK and TypeScript SDK references:

list (Python SDK)

list (TypeScript SDK)

Delete Snapshots

Daytona provides options to delete snapshots. Deleted snapshots cannot be recovered.

  1. Navigate 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 = Daytona()
daytona.snapshot.delete("my-awesome-snapshot")
print("Snapshot deleted")

For more information, see the Python SDK and TypeScript SDK references:

delete (Python SDK)

delete (TypeScript SDK)

Run Docker in a Sandbox

Daytona Sandboxes can run Docker containers inside them (Docker-in-Docker), enabling you to build, test, and deploy containerized applications. This is particularly useful when your projects have dependencies on external services like databases, message queues, or other microservices.

Agents can seamlessly interact with these services since they run within the same sandbox environment, providing better isolation and security compared to external service dependencies. The following use cases are supported:

  • 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

Create a Docker-in-Docker Snapshot

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.

Using pre-built images

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

Using 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 -

Run Kubernetes in a Sandbox

Daytona 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.

Run k3s in a Sandbox

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

import { Daytona } from '@daytonaio/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)

Default Snapshot

When a sandbox is created with no snapshot specified, Daytona uses a default snapshot that includes python, node, their language servers, and several common pip packages:

  • anthropic (v0.49.0)
  • beautifulsoup4 (v4.13.3)
  • daytona_sdk (v0.11.1)
  • django (v5.1.7)
  • flask (v3.1.0)
  • huggingface (v0.0.1)
  • instructor (v1.7.3)
  • keras (v3.9.0)
  • langchain (v0.3.20)
  • llama-index (v0.12.22)
  • matplotlib (v3.10.1)
  • numpy (v2.2.3)
  • ollama (v0.4.7)
  • openai (v1.65.4)
  • opencv-python (v4.11.0.86)
  • pandas (v2.2.3)
  • pillow (v11.1.0)
  • pydantic-ai (v0.0.35)
  • requests (v2.32.3)
  • scikit-learn (v1.6.1)
  • scipy (v1.15.2)
  • seaborn (v0.13.2)
  • SQLAlchemy (v2.0.38)
  • transformers (v4.49.0)