LinuxCommandLibrary

krunvm

Run OCI images as microVMs

TLDR

Create MicroVM based on Fedora

$ krunvm create [docker.io/fedora] --cpus [number_of_vcpus] --mem [memory_in_megabytes] --name "[name]"
copy

Start a specific image
$ krunvm start "[image_name]"
copy

List images
$ krunvm list
copy

Change a specific image
$ krunvm changevm --cpus [number_of_vcpus] --mem [memory_in_megabytes] --name "[new_vm_name]" "[current_vm_name]"
copy

Delete a specific image
$ krunvm delete "[image_name]"
copy

SYNOPSIS

krunvm [OPTIONS] [IMAGE]

PARAMETERS

--cpus, -c N
    Set number of virtual CPUs (default: 1)

--memory, -m SIZE
    Set guest memory size, e.g., 1G or 1024M (default: 1G)

--kernel PATH
    Path to guest kernel image

--initrd PATH
    Path to guest initrd image

--root PATH
    Path to guest root filesystem

--hypervisor HYPERVISOR
    Hypervisor to use: qemu or cloud-hypervisor (default: qemu)

--machine-type TYPE
    Machine type: pc, q35, virt (default: pc)

--net
    Enable user-mode networking (slirp)

--api-sock PATH
    Unix socket for VMM API

--serial PATH
    Path for serial console output

--help
    Print help

--version
    Print version

DESCRIPTION

krunvm is a lightweight command-line tool designed to run microVMs on Linux hosts using the KVM hypervisor. It supports launching virtual machines directly from OCI-compliant container images, kernels, initrds, or root filesystems, making it ideal for secure container workloads in VM isolation.

Key features include automatic kernel selection, support for multiple hypervisors like QEMU and Cloud Hypervisor, networking via slirp or host networking, and integration with tools like Podman for VM-based containers. It emphasizes low overhead, fast boot times, and simplicity, suitable for serverless computing, Kata Containers, or running untrusted code securely.

krunvm handles guest setup including device passthrough, serial console output, and API sockets for runtime control. It's written in Rust for safety and performance, part of the broader containers ecosystem.

CAVEATS

Requires KVM module and hardware virtualization support (Intel VT-x or AMD-V). Nested virtualization needed for VMs inside VMs. OCI images must be compatible; large images increase boot time. Limited device passthrough compared to full QEMU.

EXAMPLE USAGE

krunvm --cpus 2 --memory 2G quay.io/oci/ubuntu:latest
Launches Ubuntu microVM with 2 CPUs and 2GB RAM.

KERNEL MODE

krunvm --kernel /path/to/vmlinuz --initrd /path/to/initrd.img --root /path/to/rootfs.squashfs
Runs VM from explicit kernel components.

HISTORY

Developed by the containers organization (GitHub: containers/krunvm) starting around 2022. Integrated into Fedora and Podman machine for VM-backed containers. Focuses on replacing heavier tools like libvirt for microVM use cases; actively maintained with Rust-vmm contributions.

SEE ALSO

qemu(1), cloud-hypervisor(1), virt-install(1), podman-machine(1)

Copied to clipboard