Skip to content

verity volumes: pre-load docker images and data into CVMs#752

Open
h4x3rotab wants to merge 8 commits into
masterfrom
verity-volumes
Open

verity volumes: pre-load docker images and data into CVMs#752
h4x3rotab wants to merge 8 commits into
masterfrom
verity-volumes

Conversation

@h4x3rotab

@h4x3rotab h4x3rotab commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

What this does

Starting a CVM is slow mostly because of image extraction — decompressing layers and writing millions of files to the encrypted disk. A verity volume skips that: a read-only, dm-verity-protected disk, built once, whose layers are already extracted. The CVM verifies blocks lazily as the app reads them, and one volume can back many CVMs.

How it fits together

  • dstack verity <image>… builds the volume through oci-client, without a Docker daemon, and lays out the overlay2 store deterministically. --dir packs a plain directory instead.
  • The guest verifies and seeds attached volumes before the container runtime starts. Missing or mismatched volumes fail safely and fall back to a normal pull.
  • The VMM resolves named volumes under volumes_dir and attaches them read-only through dstack deploy --volume.
  • Attestation binds each verity_root through app-compose.json and therefore the measured app_id.

Design and trade-offs are documented in docs/verity-volumes.md.

Rebased and relocated onto the unified monorepo layout from PR #770.

Validation

  • cargo test -p dstack-verity -p dstack-cli -p dstack-vmm -p dstack-guest-agent -p dstack-types
  • reuse lint
  • prek run --all-files

@h4x3rotab h4x3rotab changed the title verity volumes: reproducible dm-verity image/data pre-seeding for CVMs verity volumes: pre-load docker images and data into CVMs Jul 4, 2026
@h4x3rotab h4x3rotab force-pushed the verity-volumes branch 12 times, most recently from b0a463a to 109c584 Compare July 4, 2026 23:16
Comment thread dstack/vmm/src/app/qemu.rs Fixed
Comment thread dstack/vmm/src/app/qemu.rs Fixed
Comment thread dstack/vmm/src/app/qemu.rs Fixed
h4x3rotab and others added 7 commits July 12, 2026 21:01
Add read-only verity volumes -- extra virtio-blk disks a CVM can mount
instead of pulling and unpacking their contents. A volume is declared in
app-compose.json as `{ verity_root, target }`, and attached at deploy time
with `--volume <name>`: the vmm looks the name up under cvm.volumes_dir and
attaches it read-only. Because verity_root is part of the measured compose,
the guest can check the bytes it's handed against it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Just before dockerd starts, dstack-prepare.sh runs the seeding helper. For
each volume declared in the compose it finds the matching disk by opening it
with veritysetup against the measured verity_root, then either seeds docker's
overlay2 store (target "docker") so the images are already present, or mounts
the volume at a path (a data volume). It's fail-safe throughout: a volume
that's missing or doesn't verify is skipped, and its images just pull.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`dstack verity <image>...` builds a squashfs + dm-verity volume that
pre-extracts docker images (or, with `--dir`, a plain directory) so a CVM can
start without pulling or unpacking them. It fetches images itself through
oci-client -- no docker daemon -- and lays out the overlay2 store
deterministically (each layer's directory id is its chain-id, with a fixed
timestamp and salt). The same inputs always produce the same verity_root, so
anyone can recompute it from the pinned image digests and confirm what's in
the volume without trusting the builder. `dstack deploy --volume` attaches
the result.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread dstack/vmm/src/app/qemu.rs Fixed
Comment thread dstack/vmm/src/app/qemu.rs Fixed
Comment thread dstack/vmm/src/app/qemu.rs Fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants