Skip to content

Snapshots

Snapshots are Sandbox templates that can be created from Docker or OCI compatible images. New Sandboxes can be created from a custom Snapshot pre-configured with your required dependencies, settings, and resources, or from the default Snapshot.

Creating Snapshots

Snapshots can be created in one of four ways: from a public image, from a private image, from a local image, or using the Declarative Builder.

Using a Public Image

To create a Snapshot from a public image, follow these steps:

  1. Visit the Dashboard and click on Snapshots
  2. Click on Create Snapshot
  3. Enter the name and tag of any publicly accessible image from Docker Hub (e.g. alpine:3.21.3) or from another public container registry (e.g. my-public-registry.com/custom-alpine:3.21)

Optionally, set the entrypoint field. If the image does not have a long-running entrypoint, Daytona will automatically run sleep infinity to prevent the container from exiting immediately.

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

Images from Private Registries

To create a Snapshot from an image that is available in a private container registry:

  1. Go to the Registries page in the Dashboard
  2. Click the Add Registry button.
  3. Fill out the form with an appropriate custom name, URL, username, password, and project (if applicable)
  4. Once the Container Registry is created, you may go back to the Snapshots page
  5. 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)

The next step is the same; simply set the CreateSandboxFromSnapshotParams field to use the custom Snapshot and no further authentication is needed.

Using a Private Docker Hub Image

To use a private Docker Hub image, you’ll need to add a Container Registry with your Docker Hub credentials:

  • Registry URL: Set this to docker.io
  • Username: Enter your Docker Hub username (the account with access to the private image)
  • Password: Use a Docker Hub Personal Access Token (not your account password)
  • Create the Snapshot: Once the registry is added, you can create a Snapshot using the full image path as the image name: docker.io/<username>/<image>:<tag>

Using a Local Image

In order to avoid having to manually set up a private container registry and push your image there, the Daytona CLI allows you to create a Snapshot from your local image or from a local Dockerfile and use it in your Sandboxes.

To create a Snapshot from a local image:

  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, to do it through the CLI, 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 you can use the --context flag.

Terminal window
daytona snapshot create data-analysis01 --dockerfile ./Dockerfile
Building image from /Users/idagelic/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 the Declarative Builder

The declarative builder allows you to define your Snapshots using a code-first approach. See Declarative Builder for more information.

Specifying Resources

Snapshots can be customized with specific resource requirements. By default, Daytona Sandboxes come with 1 vCPU, 1GB RAM, and 3GiB disk.

To customize these resources, use the Resources class to define exactly what you need:

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"),
# All resource parameters are optional:
resources=Resources(
cpu=2,
memory=4,
disk=8,
),
),
on_logs=print,
)

Check your available resources and limits in the dashboard.

Using Snapshots

To use a Snapshot in your Sandbox, specify the snapshot field in the CreateSandboxFromSnapshotParams object:

sandbox = daytona.create(CreateSandboxFromSnapshotParams(
snapshot="my-snapshot-name",
))

For examples of running code inside a sandbox, see the Getting Started Guide.

Deleting Snapshots

To delete custom Snapshots:

  1. Go to the Snapshots page
  2. Click the three dots at the end of the row for the Snapshot you want to delete
  3. Click the Delete button that appears

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

Creating a DinD Snapshot

You can 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

Manual Docker Installation

Alternatively, you can 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 -

Use Cases

  • 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

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)