Skip to content

Example Firecracker runner with lazy OCI rootfs via virtio-fs - #25

Closed
imjasonh wants to merge 3 commits into
mainfrom
cursor/firecracker-container-vm-c2c8
Closed

Example Firecracker runner with lazy OCI rootfs via virtio-fs#25
imjasonh wants to merge 3 commits into
mainfrom
cursor/firecracker-container-vm-c2c8

Conversation

@imjasonh

@imjasonh imjasonh commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Summary

Example Firecracker VM runner that uses a container image as the guest rootfs, loading files on demand via gzip zran-style seeking + HTTP range requests, served through virtio-fs (vhost-user-backend + fuse-backend-rs).

Crates

  • fc-oci-fs — OCI registry client, gzip index, tar TOC, read-only overlay FileSystem
  • fc-vhostfsd — vhost-user virtio-fs daemon
  • fc-runner — Spawns fc-vhostfsd and configures Firecracker (PUT /vhost-user-devices/rootfs)

Highlights

  • Lazy layer pulls with indexed_deflate + tar TOC (dagdotdev explore approach)
  • Registry auth via ~/.docker/config.json (cred helpers supported)
  • Prometheus metrics: bytes saved vs full pull, startup time, RSS, cache size
  • Tests + benchmarks (cargo test, cargo bench -p fc-oci-fs)

Host setup (new)

README now includes a Quickstart with concrete steps for downloading/building dependencies:

Script Output
scripts/download-firecracker.sh .deps/firecracker (official release; block/net only)
scripts/build-firecracker-virtiofs.sh .deps/firecracker-virtiofs (PR #5773 generic vhost-user)
scripts/build-vmlinux-virtiofs.sh .deps/vmlinux-virtiofs (CONFIG_VIRTIO_FS=y)
scripts/setup-host.sh Runs both build scripts

Important: Stock Firecracker CI vmlinux from S3 does not enable virtio-fs; released Firecracker binaries do not expose virtio-fs via generic vhost-user yet.

Test plan

  • cargo test (unit + vhost_e2e integration)
  • cargo bench -p fc-oci-fs
  • Full VM smoke test with KVM + built .deps/ artifacts (manual)
Open in Web Open in Cursor 

cursoragent and others added 3 commits June 23, 2026 01:58
Implement an example stack that serves container image layers on demand
via gzip zran-style indexing (dagdotdev explore approach), exposes the
merged overlay through virtio-fs using vhost-user-backend, and includes
fc-runner to orchestrate Firecracker with the generic vhost-user API.

Includes unit tests, vhost-user integration test, and criterion benchmarks.

Co-authored-by: Jason Hall <imjasonh@users.noreply.github.com>
- Resolve registry credentials from ~/.docker/config.json via docker_credential
  (auths, credHelpers, credsStore)
- Expose /metrics on fc-vhostfsd with bytes saved, startup time, RSS, cache size
- Document VMM frontend options and guest vmlinux requirements

Co-authored-by: Jason Hall <imjasonh@users.noreply.github.com>
- Add scripts/ for downloading official Firecracker and building
  virtio-fs-enabled firecracker + vmlinux via devtool
- Expand README with Quickstart, prerequisites, and concrete paths
- Ignore .deps/ build artifacts

Co-authored-by: Jason Hall <imjasonh@users.noreply.github.com>
@imjasonh imjasonh closed this Jun 25, 2026
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.

2 participants