Daytona Environments¶
Manage ephemeral, disposable development sandboxes with Daytona — a platform for cloud-based dev environments. This project ships module 61-daytona.sh, which installs the current Daytona CLI, writes a declarative environments registry, and installs a daytona-env wrapper that bridges the two.
2026 status: Daytona is a platform product (managed sandboxes). The legacy
daytonaio/workspace-managerOSS project was archived in June 2026 — do not use the oldget.daytona.ioinstaller. This module installs from the currentgithub.com/daytonaio/daytonareleases.
Install¶
The module runs as setup step 61 (step_daytona). Opt out with SKIP_DAYTONA=true.
# Homebrew (macOS)
brew install daytonaio/cli/daytona
# Direct binary (Linux/macOS) — done automatically by module 61
# https://github.com/daytonaio/daytona/releases/latest/download/daytona-<os>-<arch>
Auth uses the DAYTONA_API_KEY environment variable only. Never commit it:
Two setup styles¶
The wrapper supports both an imperative CLI flow and a declarative config flow — pick either, or mix them.
(a) Imperative CLI¶
daytona login # authenticate (DAYTONA_API_KEY)
daytona-env list # show registry entries
daytona-env create dev-minimal # compose + run daytona create
daytona-env status # daytona list
daytona-env delete <id|name> # remove a sandbox
daytona-env prune # delete ALL sandboxes (confirms first)
Raw daytona create flags you can use directly:
| Flag | Meaning | Example |
|---|---|---|
--cpu | vCPUs | --cpu 2 |
--memory | RAM (GB) | --memory 4 |
--disk | Disk (GB) | --disk 10 |
--auto-stop | Idle minutes before auto-stop | --auto-stop 15 |
--env K=V | Environment variable (repeatable) | --env NODE_ENV=development |
--label L | Label (repeatable) | --label dev |
--snapshot S | Build from a snapshot | --snapshot debian-slim |
--dockerfile/-f D | Build from a Dockerfile | --dockerfile ./Dockerfile |
--target T | Target region/provider | --target us |
Create a snapshot from the same Dockerfile your docker-compose build uses, so sandboxes mirror production images.
(b) Declarative config¶
~/.config/opencode/daytona/environments.json (generated by module 61):
{
"version": 1,
"managed_by": "opencode_initializer@61-daytona",
"note": "Auth via DAYTONA_API_KEY env var only — never store secrets here.",
"defaults": { "cpu": 2, "memory_gb": 4, "disk_gb": 10, "auto_stop_minutes": 15, "target": "us" },
"environments": [
{ "name": "dev-minimal", "image": { "snapshot": "debian-slim" }, "labels": ["dev"] },
{ "name": "dev-node", "image": { "dockerfile": "./Dockerfile" }, "env": { "NODE_ENV": "development" }, "auto_stop_minutes": 30 }
]
}
| Field | Type | Description |
|---|---|---|
version | int | Registry schema version |
managed_by | string | Provenance marker |
defaults | object | Fallbacks for cpu/memory_gb/disk_gb/auto_stop_minutes/target |
environments[] | array | One entry per environment |
.name | string | Environment name (matches daytona-env create <name>) |
.image.snapshot | string | Build from snapshot (mutually exclusive with dockerfile) |
.image.dockerfile | string | Build from Dockerfile path |
.env | object | Key/value pairs → repeated --env flags |
.labels | array | Strings → repeated --label flags |
Override the registry location per project:
OpenCode integration¶
The opencode-daytona plugin (installed separately) lets the agent spawn sandboxes. Git-sync caveat: agent branches inside a sandbox are disposable — commit work back to the main repo before the sandbox is pruned, or the changes are lost with it.
Ephemeral-by-default best practices¶
- Auto-stop / auto-delete — set short
auto_stop_minutes; prune idle sandboxes withdaytona-env prune. - Volumes for data — persist state in mounted volumes, not the sandbox root filesystem.
- Network isolation — for untrusted or third-party code, run with network access blocked; grant it only when a build genuinely needs it.
- One sandbox, one task — treat a sandbox as disposable; never accumulate state you would mind losing.