cli/docs/cmd/vm/index.md
Snider 996fae70f4 docs: sync php, pkg, vm with CLI, update coverage tracking
- php: comprehensive rewrite with all 20+ subcommands documented
- pkg: added full documentation with flags and examples
- vm: added examples and detail for all commands
- TODO.md: updated to show current coverage (12/13 at 100%)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 18:39:10 +00:00

2.6 KiB

core vm

LinuxKit VM management.

LinuxKit VMs are lightweight, immutable VMs built from YAML templates. They run using qemu or hyperkit depending on your system.

Usage

core vm <command> [flags]

Commands

Command Description
run Run a LinuxKit image or template
ps List running VMs
stop Stop a VM
logs View VM logs
exec Execute command in VM
templates Manage LinuxKit templates

vm run

Run a LinuxKit image or build from a template.

core vm run <image> [flags]
core vm run --template <name> [flags]

Supported image formats: .iso, .qcow2, .vmdk, .raw

Flags

Flag Description
--template Run from a LinuxKit template (build + run)
--var Template variable in KEY=VALUE format (repeatable)
--name Name for the container
--memory Memory in MB (default: 1024)
--cpus CPU count (default: 1)
--ssh-port SSH port for exec commands (default: 2222)
-d Run in detached mode (background)

Examples

# Run from image file
core vm run image.iso

# Run detached with more resources
core vm run -d image.qcow2 --memory 2048 --cpus 4

# Run from template
core vm run --template core-dev --var SSH_KEY="ssh-rsa AAAA..."

# Multiple template variables
core vm run --template server-php --var SSH_KEY="..." --var DOMAIN=example.com

vm ps

List running VMs.

core vm ps [flags]

Flags

Flag Description
-a Show all (including stopped)

Output

ID        NAME      IMAGE                STATUS    STARTED   PID
abc12345  myvm      ...core-dev.qcow2    running   5m        12345

vm stop

Stop a running VM by ID or name.

core vm stop <id>

Supports partial ID matching.

Examples

# Full ID
core vm stop abc12345678

# Partial ID
core vm stop abc1

vm logs

View VM logs.

core vm logs <id> [flags]

Flags

Flag Description
-f Follow log output

Examples

# View logs
core vm logs abc12345

# Follow logs
core vm logs -f abc1

vm exec

Execute a command in a running VM via SSH.

core vm exec <id> <command...>

Examples

# List files
core vm exec abc12345 ls -la

# Open shell
core vm exec abc1 /bin/sh

See Also

  • templates - Manage LinuxKit templates
  • build - Build LinuxKit images
  • dev - Dev environment management