Skip to main content

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 around docker 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 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 like vastai/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 portal landing page

The Instance Portal provides easy access links to services running in your instance. It places an authentication layer in front of these services to prevent access by anyone who does not have the correct authentication token. You can also create tunnels to your services without exposing ports. Full documentation for the Instance Portal is available in our Instance Portal guide.

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
You can edit VM templates just like regular templates, but you should not change the docker image field. Only the images we distribute from docker.io/vastai/kvm will work. To learn how to customize our recommended templates with provisioning scripts or build your own custom Docker images, see our Advanced Setup guide.

Next Steps

Ready to start using templates? Here’s what you can do:
  • Try it now - Follow our Quick Start guide to run your first template in minutes
  • Create your own - See Creating Templates to build a custom template
  • Learn more - Explore Advanced Setup for provisioning scripts and custom Docker images
I