Vast.ai now offers full virtual machines (VMs) in addition to Docker-based instance rentals.
VMs offer the following features not available in Docker:
systemd
). This is necessary for running Docker, Kubernetes, Snap, or other containerization-based applications within an instance.ptrace
). VMs have the following drawbacks compared to Docker-based instances:
First, make sure that you have added your SSH keys to your account page first (see ssh guide), as SSH keys cannot be edited on running VMs. SSH access is currently the only method preconfigured on VM instances.
Use one of the below templates; the template will automatically filter for machines that support VMs and will launch a VM when you rent with that template:
Image (Recommended Template Link) | Available Launch Modes | Description | Provides | Use cases | Notes |
---|---|---|---|---|---|
docker.io/vastai/kvm:ubuntu_terminal (link) | direct_ssh | A Ubuntu 22.04 server VM. | CUDA, Docker | Serving Docker Compose applications; CUDA performance profiling | Will refuse to start without SSH pubkeys set; SSH pubkeys will not be able to be changed while instance is running. Env variables will be written to /etc/environment and may need to be sourced by onstart. Onstart script will need interpreter specified via shebangs. |
VM images are packaged in docker images from the docker.io/vastai/kvm
repository. VM templates must use one of these docker images.
Add vms_enabled=true
to the Extra Filters field of the template to filter for machines that support VMs.
VM images must be specified using the fully qualified server/organization/repo:tag name.
VM templates support the following flags in the "Docker options" field. These will have the same effect as in docker-based instances.
/etc/environment
. To use these environment variables in a script, run source /etc/environment
in the beginning.For more details on these options, see environment.
Currently only SSH is supported.
The On-start script field allows specifying a script to run on instance start. Unlike in docker-based instances, the interpreter must be specified by a shebang (e.g. #!/bin/bash
for bash.)
vastai vm copy $SRC $DEST
.