Lightweight MicroVM engine with dual hypervisor backends: Cloud Hypervisor (default) and Firecracker. One hypervisor process per VM, every command standalone (a resident daemon is optional); Docker-like CLI; snapshots that clone into new identities in tens of milliseconds.
cocoon CLI ──► images: OCI (EROFS layers, direct boot) | cloudimg (qcow2, UEFI)
──► vm: create/run/console/exec ── CH or FC, COW disk, CNI/bridge NIC
──► snapshot: save/clone/restore/hibernate ── export/import across hosts
--windows path and the patched
CH/firmware forks it needs--fc trades for ~125ms
boots and <5 MiB overheadnet_scope keys host device names per installation so co-hosted cocoon roots never GC each other’s guests--cpu is a hard cap); raw weight/quota/burst knobs, an optional host-core fence (cgroup_cpus), and per-VM pinning (--cpuset-cpus); see CPU Isolation--queue-size, default 512); TSO/UFO/csum offload enabled by default--user/--password, multi-NIC Netplan v2 network-config); cidata is automatically skipped on subsequent boots--data-disk attaches additional virtio-blk disks per VM, with optional ext4 mkfs at create time, cloud-init mounts: auto-mount on cloudimg+CH (via /dev/disk/by-id/virtio-<name>), per-disk DirectIO override, and 1:1 inheritance through snapshot/clone/restore; vm clone --data-disk adds fresh disks to a clone and vm disk attach/detach hot-plugs existing raw files on a running VM (both CH only)mmap memory restore: no eager copy, page cache shared across sibling clones; hugepages/shared snapshots fall back to eager copy with a warningvm create --hugepages (Cloud Hypervisor only); backs VM memory with hugetlbfs at the cost of the mmap restore fast path for that VM’s snapshots (never supported on Firecracker, whose snapshots cannot restore from hugetlbfs)--mergeable (Cloud Hypervisor only) madvises guest memory MADV_MERGEABLE so host KSM can dedup identical pages across VMs; excludes --hugepages/--shared-memorycocoon vm console with bidirectional PTY relay, SSH-style escape sequences (~. disconnect, ~? help), configurable escape character, SIGWINCH propagationcocoon snapshot save captures a running VM’s full state (memory, disks, config); cocoon vm clone restores it as a new VM with fresh network and identity; guest resources (CPU, memory, storage, NIC count) inherit verbatim from the snapshot, while host-side cgroup CPU policy comes from clone flags (see CPU Isolation)cocoon snapshot export packages a snapshot into a portable .tar archive (.tar.gz with --gzip, sparse-aware pax headers); cocoon snapshot import restores it on another host or cluster; supports piping via stdout/stdin for direct host-to-host transfer; --to-dir writes a directory form (with snapshot.json envelope) for NFS / rsync-friendly handoffcocoon vm clone --from-dir DIR and cocoon vm restore --from-dir DIR consume any directory containing a snapshot.json envelope without first registering the snapshot in the local DB; the dir is treated as read-only so multi-VM golden-image use cases work without copyingcocoon vm status watches VM state changes in real time via fsnotify, with refresh mode (top-like) and event-stream mode (append-only, for scripting and vk-cocoon integration)create, run, start, stop, list, inspect, console, rm, debug, clone, status--log-level), log rotation (max size / age / backups)cocoon vm debug generates a copy-pasteable cloud-hypervisor command for manual debugging--fc flag selects Firecracker for OCI images: ~125ms boot, <5 MiB overhead, minimal attack surface (no UEFI, no qcow2, no Windows)cocoon daemon optionally adopts running VMs to converge crashes as they happenSource and issue tracker: github.com/cocoonstack/cocoon. Part of the cocoonstack MicroVM platform.