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’sdebianSlim() 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
ThepipInstall() method accepts these options:
| Option | Type | Description |
|---|---|---|
findLinks | string[] | URLs to search for packages |
indexUrl | string | Base URL of Python Package Index |
extraIndexUrls | string[] | Extra URLs for package index |
pre | boolean | Include pre-release and development versions |
extraOptions | string | Raw options passed to pip install |
Best Practices
- Use snapshots for repeated builds: If you’re creating multiple sandboxes with the same image, create a snapshot first:
- Layer optimization: Order commands from least to most frequently changing to maximize Docker layer caching.
- Keep images small: Only install necessary packages to reduce build time and storage.
-
Use build logs: Enable
onSnapshotCreateLogsto monitor build progress and debug issues.
Related
- Resource Management - Configure CPU, memory, and disk
- Snapshots - Create reusable images