Skip to main content

Overview

Daytona supports creating sandboxes from custom Docker images in two ways:
  • Pre-built images from Docker registries
  • Dynamic images using Daytona’s declarative Image builder

Using Pre-built Images

You can create sandboxes from any public or private Docker image:

Declarative Image Builder

Daytona provides a declarative API for building custom images programmatically:

Base Images

Start with a base image using one of these methods:

Installing Python Packages

Adding Files and Directories

Environment Variables and Working Directory

Complete Example

Using Dockerfiles

You can also build images from existing Dockerfiles:

Advanced Dockerfile Commands

For advanced use cases, you can add raw Dockerfile commands:

Image Build Options

Supported Python Versions

Daytona’s debianSlim() method supports:
  • Python 3.9 (3.9.22)
  • Python 3.10 (3.10.17)
  • Python 3.11 (3.11.12)
  • Python 3.12 (3.12.10)
  • Python 3.13 (3.13.3)

Pip Install Options

The pipInstall() method accepts these options:

Best Practices

  1. Use snapshots for repeated builds: If you’re creating multiple sandboxes with the same image, create a snapshot first:
  1. Layer optimization: Order commands from least to most frequently changing to maximize Docker layer caching.
  2. Keep images small: Only install necessary packages to reduce build time and storage.
  3. Use build logs: Enable onSnapshotCreateLogs to monitor build progress and debug issues.