Snapshots
Snapshots are pre-configured templates containing all dependencies, tools, environment settings and resource requirements for your Daytona Sandbox. Daytona supports creating Snapshots from all standard Docker or OCI compatible images.
Creating Snapshots
When spinning up a Sandbox, Daytona uses a Snapshot based on a simple image with some useful utilities pre-installed, such as python
, node
, pip
as well as some common pip packages. More information below.
It is possible to override this behavior and create custom Snapshots by visiting the Dashboard, clicking on Snapshots and on Create Snapshot
.
For the Snapshot image, you may enter the name and tag of any publicly accessible image from Docker Hub such as alpine:3.21.3
and debian:12.10
or from another public container registry - e.g. my-public-registry.com/custom-alpine:3.21
.
The entrypoint field is optional and if the image hasn’t got a long-running entrypoint, Daytona will ensure sure that the resulting container won’t exit immediately upon creation by automatically running sleep infinity
.
Once the Snapshot is pulled, validated and has an Active
state, it is ready to be used. Define the CreateSandboxFromSnapshotParams
object to specify the custom Snapshot to use:
sandbox = daytona.create(CreateSandboxFromSnapshotParams( snapshot="my-snapshot-name",))
const sandbox = await daytona.create({ snapshot: "my-snapshot-name",})
Full example:
from daytona import Daytona, CreateSandboxFromSnapshotParams
daytona = Daytona()
sandbox = daytona.create(CreateSandboxFromSnapshotParams(snapshot="my-snapshot-name",))
response = sandbox.process.code_run('print("Sum of 3 and 4 is " + str(3 + 4))')if response.exit_code != 0:print(f"Error running code: {response.exit_code} {response.result}")else:print(response.result)
sandbox.delete()
import { Daytona } from '@daytonaio/sdk'
async function main() { // Initialize the Daytona client const daytona = new Daytona()
try { // Create the Sandbox instance const sandbox = await daytona.create({ snapshot: "my-snapshot-name", }) // Run the code securely inside the Sandbox const response = await sandbox.process.codeRun( 'print("Sum of 3 and 4 is " + str(3 + 4))', ) if (response.exitCode !== 0) { console.error('Error running code:', response.exitCode, response.result) } else { console.log(response.result) } } catch (error) { console.error('Sandbox flow error:', error) } finally { // Clean up the Sandbox await sandbox.delete() }}
main()
Images from Private Registries
To create a Snapshot from an image that is not publicly available, you need to start by adding the image’s private Container Registry:
- Go to the Registries page in the Dashboard
- Click the
Add Registry
button. - Input the Registry’s name and URL, username, password, project, and submit
- Once the Container Registry is created, you may go back to the Snapshots page
- When creating the Snapshot, make sure to input the entire private image name, including the registry location and project name -
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 more authentication is needed.
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.
After running docker images
and ensuring the image and tag you want to use is available use the daytona snapshot push
command to create a Snapshot and push it to Daytona, e.g.:
daytona snapshot push custom-alpine:3.21
If you haven’t built the desired image yet, and have a Dockerfile ready, you can use the Declarative Builder in our SDK - read more about it here.
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:
daytona snapshot create trying-daytona:0.0.1 --dockerfile ./Dockerfile --context ./requirements.txt
Building image from /Users/idagelic/docs/DockerfileStep 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
Deleting Snapshots
Deleting your custom Snapshots is a straightforward process. Simply go to the Snapshots page and click on the Delete
button that shows up when clicking the three dots at the end of a row of the Snapshot you want deleted.
Default Snapshot
The default Snapshot used by Daytona is based on an image that contains python
, node
and their respective LSP’s, as well as these pre-installed pip
packages:
beautifulsoup4
(v4.13.3)django
(v5.1.7)flask
(v3.1.0)keras
(v3.9.0)matplotlib
(v3.10.1)numpy
(v2.2.3)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)anthropic
(v0.49.0)daytona_sdk
(v0.11.1)huggingface
(v0.0.1)instructor
(v1.7.3)langchain
(v0.3.20)llama-index
(v0.12.22)ollama
(v0.4.7)