What is a Template?
A template is how Vast helps you launch an instance, setting up your rented machine with whatever software and formatting you need. Templates are generally used for launching instances through the web interface, but they can also be used in the CLI or through the API. In this document, we will focus on the web interface, but we will link to other relevant documentation throughout. In the simplest technical terms, you can consider a template to be a wrapper arounddocker run. The template contains all of the information you want to pass to our systems to configure the environment.
You can browse the template section of the web interface at cloud.vast.ai/templates
Recommended Templates
We provide several recommended templates to help you get started. These are pre-configured environments that you can use as-is, or you can tweak them to your own requirements.It’s a great idea to look at how these templates have been configured to guide you in creating your own.
Vast.ai Base Images
Our recommended templates are built on Vast.ai base images likevastai/base-image and vastai/pytorch. You can find the source code on GitHub.
These are large Docker images that contain CUDA development libraries, node + npm, OpenCL and other useful libraries. Despite their large size you’ll find they generally start quickly because they have been cached on many of the host machines.
Why use Vast.ai base images?
- Faster cold boots due to frequent caching on host machines
- Built-in security features through Caddy proxy
- Automatic TLS encryption for web services
- Authentication token protection for all services
- Proper isolation between external and internal services
- Instance Portal integration (explained below)
- PROVISIONING_SCRIPT support for easy customization
Instance Portal
When you click the Open button on an instance running one of our recommended templates, you’ll see the Instance Portal:
Instance portal landing page
Instance Setup
Docker Execution Environment
The standard and most common way to run instances on Vast.ai is using Docker containers. When you select a template, it launches a Docker container with your specified image and configuration. Docker templates are ideal for:- Running pre-configured ML frameworks (PyTorch, TensorFlow, etc.)
- Deploying web services and APIs
- Development environments with Jupyter notebooks
- Custom applications with specific dependencies
Virtual Machine Templates
In addition to standard Docker container templates, we also offer Virtual Machine (VM) templates. These launch a full virtual machine environment rather than a docker container. When to use VM templates:- Run applications that require namespace support
- Run more than one Docker container in an instance
- Load kernel modules or run profiling jobs
- Mount remote drives with rclone or similar
docker.io/vastai/kvm will work.