Skip to main content
A sandbox created from a CAS image exposes /dev/kvm, so you can run virtual machines inside it with any KVM-based hypervisor. Snapshot-restore and all other features are supported for sandboxes with nested VMs running inside of them. This guide builds an image with QEMU and an Ubuntu cloud image, boots that cloud image as a VM inside a sandbox, and connects to it over SSH.

Build an Image with QEMU

The Dockerfile installs QEMU, virtme-ng, and a kernel for the nested VM:
Dockerfile

Create the Sandbox and Check KVM

Create the sandbox with enough CPUs, memory, and disk for the VM, then confirm the KVM device is there. The QEMU packages make /dev/kvm owned by root:kvm, so the commands in this guide run as root:

Boot a VM

vng boots the installed kernel under QEMU with KVM acceleration from the sandbox’s own filesystem, runs a command inside the VM, and shuts it down. The output is the VM’s kernel, not the sandbox’s:

See Also

CAS Images

The image format that exposes KVM inside a sandbox.

Snapshot and Clone

Save and restore a sandbox with its running VM.

Live Resize

Give a running sandbox more CPUs and memory for its VMs.