Reusable Environments
Build a sandbox image once, then restore from snapshot on every run.
environments
Demonstrates sandbox environments: build a reusable sandbox image once, then restore from the snapshot on every subsequent run — skipping the setup entirely.
Setup
bunx alineo-cli init # starts OpenSandbox in Docker (one-time setup)Run
bun install
bun start # ~30–60s first run (builds environment)
bun start # ~2–3s on subsequent runs (restores from snapshot)What it does
First run — environment not yet cached:
- Installs Python 3 and pip into a
debian:bookworm-slimcontainer - Installs
numpyandpandasvia pip - Snapshots the container and saves the snapshot ID to the ledger
Subsequent runs — environment cached:
- Finds the existing snapshot in the ledger
- Boots directly from the snapshot — no apt-get or pip install
- Runs
import numpy, pandasto prove packages are already present
The ledger entry is keyed by the environment name ("python-data-science"), so the snapshot is reused across process restarts.