Skip to content

VM Sandboxes

View as Markdown

Daytona provides VM sandboxes for workloads that require a full virtual machine with a dedicated Linux or Windows operating system.

VM sandboxes are distinct from container sandboxes and support VM-only capabilities such as pause/resume sandboxes and hot/cold snapshots. All other sandbox features and functionality are the same as for container sandboxes.

Daytona provides methods to create Linux VM sandboxes.

  1. Navigate to Daytona Sandboxes ↗

  2. Click Create Sandbox

  3. Select a Linux VM snapshot:

    • daytona-vm-small
    • daytona-vm-medium
    • daytona-vm-large
  4. Click Create

from daytona import Daytona, CreateSandboxFromSnapshotParams
daytona = Daytona()
sandbox = daytona.create(CreateSandboxFromSnapshotParams(snapshot="daytona-vm-small"))

Daytona provides methods to create custom Linux VM sandboxes.

  1. Create a snapshot from a base image
  2. Set sandbox class to LINUX_VM
  3. Create a Linux VM sandbox from the snapshot
from daytona import (
Daytona,
CreateSnapshotParams,
CreateSandboxFromSnapshotParams,
SandboxClass,
)
daytona = Daytona()
# 1. Create a VM snapshot (linux-vm class)
daytona.snapshot.create(
CreateSnapshotParams(
name="my-vm-snapshot",
image="ubuntu:22.04",
sandbox_class=SandboxClass.LINUX_VM,
)
)
# 2. Create a VM sandbox from the snapshot
sandbox = daytona.create(CreateSandboxFromSnapshotParams(snapshot="my-vm-snapshot"))

Daytona provides methods to create Windows VM sandboxes.

  1. Navigate to Daytona Sandboxes ↗

  2. Click Create Sandbox

  3. Select a Windows snapshot:

    • windows-small
    • windows-medium
    • windows-large
  4. Click Create

from daytona import Daytona, CreateSandboxFromSnapshotParams
daytona = Daytona()
sandbox = daytona.create(
CreateSandboxFromSnapshotParams(
snapshot="windows-small",
)
)

Daytona provides methods to create a VM snapshot from an existing Linux or Windows VM sandbox.

A snapshot captures a point-in-time copy of a sandbox that you can use as a base to create new sandboxes. The resulting snapshot inherits the source sandbox’s class and can only create sandboxes of that same class.

VM sandboxes support cold and hot snapshots through the includeMemory parameter:

  • Cold snapshot (includeMemory: false, default): captures filesystem state only. The sandbox must be stopped.
  • Hot snapshot (includeMemory: true): captures filesystem and memory state. The sandbox must be started. Running applications are preserved and instantly available on any new sandbox created from the snapshot.
Include memorySnapshot typeSnapshot contentsRequired sandbox state
false (default)ColdFilesystem onlyStopped
trueHotFilesystem and memoryStarted
# Cold snapshot (filesystem only, sandbox stopped)
sandbox._experimental_create_snapshot("my-vm-snapshot")
# Hot snapshot (filesystem and memory, sandbox running)
sandbox._experimental_create_snapshot("my-vm-snapshot", include_memory=True)

Daytona provides methods to pause and resume VM sandboxes.

Pausing a VM sandbox preserves its filesystem and memory state, and does not consume CPU. To resume a paused sandbox, start it again; processes continue from where they were paused.

sandbox.pause()