krunvm
is a CLI-based utility for creating microVMs from OCI images, using libkrun and buildah.
- Minimal footprint
- Fast boot time
- Zero disk image maintenance
- Zero network configuration
- Support for mapping host volumes into the guest
- Support for exposing guest ports to the host
- Linux/KVM on x86_64.
- Linux/KVM on AArch64.
- macOS/Hypervisor.framework on ARM64.
brew tap you54f/krun
brew install krunvm
dnf copr enable -y slp/libkrunfw
dnf copr enable -y slp/libkrun
dnf copr enable -y slp/krunvm
dnf install -y krunvm
krunvm create {{docker.io/fedora}} --cpus {{number_of_vcpus}} --mem {{memory_in_megabytes}} --name "{{name}}"
krunvm start "{{image_name}}"
By default it will drop into sh
krunvm start "{{image_name}}" /bin/bash
krunvm list
krunvm list --json
# Json outputkrunvm list --json | jq '.vmconfig_map[].name'
# List names only
krunvm list "{{image_name}}"
krunvm list "{{image_name}}" --json
# Json output
krunvm changevm --cpus {{number_of_vcpus}} --mem {{memory_in_megabytes}} --name "{{new_vm_name}}" "{{current_vm_name}}"
krunvm delete "{{image_name}}"
NB:- Experimental feature, will probably conflict with things in your guest.
krunvm start alpine \
--copy-environment \
--filter-environment PATH,PWD,CWD,HOME,USER,TERMCAP,HOSTNAME,SHELL,PAGER,GPG_TTY,_,LC_TERMINAL,COLORTERM,TERM_PROGRAM,TERM_SESSION_ID,SSH_AUTH_SOCK
cargo build --release
set MACOSX_DEPLOYMENT_TARGET
to 11.0
if you are building on macOS, to ensure compatibility with older versions,
built of later versions of macOS. 11.0 is the earliest for arm64
macs.
#### Examples in the wild
# Create the db MicroVM
krunvm create -p 5432:5432 --name airbase-db postgres:13.7-alpine
# Enter the vm
krunvm start airbase-db sh
# In the vm, initialize the db
POSTGRES_PASSWORD=postgres docker-entrypoint.sh postgres
# Exit the vm, and start the vm again
krunvm start airbase-db
# Create the minio MicroVM
krunvm create -p 9000:9000 -p 9001:9001 --name airbase-minio minio/minio
# Start the vm
krunvm start airbase-minio "minio server /data --console-address \":9001\""
# Init minio
mc alias set minio http://127.0.0.1:9000 minioadmin minioadmin
mc mb minio/minio-public --ignore-existing
mc mb minio/minio-private --ignore-existing
mc policy set download minio/minio-public