Quick start
The simplest way to use SmolVM is the auto-configuration mode:SmolVM() with no arguments, it automatically:
- Generates SSH keys (stored in
~/.smolvm/keys/) - Builds an Alpine Linux image with SSH pre-configured
- Creates a VM with sensible defaults (512MB RAM, 1 vCPU)
- Starts the VM when entering the context manager
Creating a sandbox
You can create a sandbox with sensible defaults or customize the configuration.- Auto-config (Recommended)
- Manual Configuration
Running commands
Therun() method executes commands via SSH and returns a CommandResult object:
Shell modes
SmolVM supports two command execution modes:VM properties
Access VM information through properties:Checking SSH capability
Not all VM images support command execution. You can check before running commands:Command execution requires the VM to be booted with
init=/init in the boot arguments. All auto-configured VMs and images built with ImageBuilder include this by default.Getting SSH connection details
Retrieve SSH commands for manual connection:Error handling
SmolVM raises specific exceptions for different failure scenarios:Next steps
VM lifecycle
Learn about starting, stopping, and managing VM lifecycles
Port forwarding
Expose guest services to your host machine
Environment variables
Inject configuration into your VMs
Custom images
Build custom rootfs images for your use case
