API

CLI Reference

Complete reference for all vmsan commands and flags

Global flags

FlagDescription
--jsonOutput structured JSON
--verboseShow detailed debug output

Commands

vmsan create

Create and start a new microVM.

FlagTypeDefaultDescription
--vcpusstring1Number of vCPUs
--memorystring128Memory in MiB
--runtimestringbaseRuntime label (base, node22, node24, python3.13)
--diskstring10gbRoot disk size
--from-imagestringBuild rootfs from a Docker/OCI image
--kernelstringPath to kernel image (auto-detected if omitted)
--rootfsstringPath to rootfs image (auto-detected if omitted)
--timeoutstringAuto-shutdown timeout (e.g. 1h, 30m, 2h30m)
--projectstringProject label for grouping VMs
--snapshotstringSnapshot ID to restore from
--publish-portstringPorts to forward (comma-separated)
--network-policystringallow-allNetwork mode: allow-all, deny-all, custom
--allowed-domainstringAllowed domains (comma-separated, wildcard *)
--allowed-cidrstringAllowed CIDR ranges (comma-separated)
--denied-cidrstringDenied CIDR ranges (comma-separated)
--bandwidthstringMax bandwidth (e.g. 50mbit)
--no-seccompbooleanfalseDisable seccomp-bpf filter
--no-pid-nsbooleanfalseDisable PID namespace isolation
--no-cgroupbooleanfalseDisable cgroup resource limits
--no-netnsbooleanfalseDisable per-VM network namespace
--connectbooleanfalseAuto-connect to shell after creation
--silentbooleanfalseSuppress all output
--from-image and --connect are mutually exclusive. Custom images do not include the agent, so connect, exec, upload, and download are unavailable for VMs created with --from-image.

vmsan list

List all VMs. Alias: ls.

vmsan start

Start a stopped VM.

ArgumentRequiredDescription
vm-idyesThe VM to start

vmsan stop

Stop a running VM.

ArgumentRequiredDescription
vm-idyesThe VM to stop

vmsan remove

Remove a VM and its chroot directory. Alias: rm.

ArgumentRequiredDescription
vm-idyesThe VM to remove

vmsan exec

Execute a command inside a running VM.

ArgumentRequiredDescription
vm-idyesThe VM to run the command in
commandyesCommand to execute, followed by args
FlagTypeDefaultDescription
--sudobooleanfalseRun as root
-i, --interactivebooleanfalseInteractive shell mode (PTY)
-w, --workdirstringWorking directory inside the VM
-e, --envstringEnvironment variable (KEY=VAL), repeatable
-t, --ttybooleanfalseAllocate a pseudo-TTY (compatibility)
--no-extend-timeoutbooleanfalseSkip timeout extension (interactive only)

vmsan connect

Open an interactive shell to a running VM.

ArgumentRequiredDescription
vm-idyesThe VM to connect to
FlagTypeDefaultDescription
-s, --sessionstringAttach to an existing shell session ID

vmsan upload

Upload one or more local files to a running VM.

ArgumentRequiredDescription
vm-idyesTarget VM
files...yesOne or more local file paths
FlagTypeDefaultDescription
-d, --deststring/rootDestination directory inside the VM

vmsan download

Download a file from a running VM.

ArgumentRequiredDescription
vm-idyesSource VM
remote-pathyesFile path inside the VM
FlagTypeDefaultDescription
-d, --deststringbasename of remote path in cwdLocal destination path

vmsan network

Update the network policy on a running VM.

ArgumentRequiredDescription
vm-idyesThe VM to update
FlagTypeRequiredDescription
--network-policystringyesNetwork mode: allow-all, deny-all, custom
--allowed-domainstringnoAllowed domains (comma-separated)
--allowed-cidrstringnoAllowed CIDR ranges (comma-separated)
--denied-cidrstringnoDenied CIDR ranges (comma-separated)

vmsan snapshot

Manage VM snapshots. This is a command group with subcommands.

vmsan snapshot create

Create a snapshot of a running VM.

ArgumentRequiredDescription
vm-idyesThe VM to snapshot
FlagTypeDefaultDescription
--no-resumebooleanfalseKeep VM paused after snapshot (default: auto-resume)

vmsan snapshot list

List all snapshots. Alias: ls.

vmsan snapshot delete

Delete one or more snapshots. Alias: rm.

ArgumentRequiredDescription
snapshot-id...yesOne or more snapshot IDs

vmsan doctor

Check system prerequisites and vmsan installation health.

Runs 8 diagnostic checks across three categories:

  • System — KVM availability, disk space, default network interface
  • Binaries — Firecracker, Jailer, Agent
  • Images — Kernel, base rootfs

Returns exit code 1 if any check fails. Supports --json for scripted health checks.

Programmatic API

vmsan also exports a TypeScript API for programmatic use:

example.ts
import { VMService, vmsanPaths, FirecrackerClient } from "vmsan";

const paths = vmsanPaths();
const service = new VMService(paths);

Key exports include VMService, FirecrackerClient, AgentClient, NetworkManager, Jailer, and ShellSession.

Copyright © 2026