Skip to main content

What are Templates?

Templates are saved configurations that define how your instance will be set up. Every instance on Vast.ai requires a template that specifies:
  • Docker image - The base container environment
  • Launch mode - How you’ll connect (SSH, Jupyter, or Entrypoint)
  • Initialization - Startup scripts and environment variables
  • Ports and networking - Required network configurations
For comprehensive template documentation including creating custom templates, see the main Templates section.

Selecting a Template

When renting an instance, you must select a template first. You have three options: Pre-configured templates for common use cases:
  • PyTorch - Ready for deep learning with Jupyter
  • TensorFlow - ML development environment
  • Stable Diffusion - Image generation UIs
  • LLM Inference - Text generation setups
  • Base Ubuntu - Clean development environment

2. Your Recent Templates

Templates you’ve previously used or customized are saved for quick access.

3. Custom Templates

Create your own or modify existing templates to match your exact needs.

Quick Template Selection

  1. On the search page, look for the template selector in the upper left
  2. Click “Change Template” to see available options
  3. Select a template that matches your needs
  4. The search will update to show compatible machines
Start with a recommended template and modify it rather than creating from scratch. This ensures compatibility and faster startup times.

Launch Modes

Templates support three connection methods:

SSH

  • Terminal access via SSH
  • Best for: Development, training scripts, command-line work
  • Includes tmux session management

Jupyter

  • Web-based notebook interface
  • Best for: Data science, experimentation, visualization
  • Includes terminal access

Entrypoint

  • Runs Docker’s native entrypoint
  • Best for: Automated workloads, API servers, production deployments
  • No automatic SSH/Jupyter setup

Important Template Settings

Docker Image

  • Always specify a version tag (avoid “latest”)
  • Vast.ai base images (vastai/pytorch) start faster due to caching
  • Custom images from Docker Hub supported

On-start Script

  • Runs after the container starts
  • Use for installing additional packages
  • Executes as bash commands

Disk Space

  • Set in the search interface (not the template)
  • Cannot be changed after instance creation
  • Default is 10GB - increase as needed

Common Issues

Template Compatibility

Not all templates work on all machines. If an instance fails to start:
  • Try a recommended template
  • Check Docker image availability
  • Verify port requirements match machine capabilities

Invalid Docker Image Path

If you get an error like “Unable to find image ‘ubuntu20.04_latest/ssh’”:
  • You have an invalid Docker image path
  • Use proper format: nvidia/cuda:12.0.1-devel-ubuntu20.04
  • Always include repository and tag
  • Test locally: docker pull <YOUR_IMAGE_PATH>
  • Use recommended templates to ensure valid paths

Image Loading Time

  • First launch can take 5-60 minutes depending on image size
  • Vast.ai base images load faster (pre-cached on many machines)
  • You’re not charged during loading

Can’t Change Template on Existing Instance

Templates are recipes for new instances. Once an instance is created:
  • Template changes only affect new instances
  • To use a different template, create a new instance
  • Transfer data if needed using data movement tools

Next Steps

Ready to customize? See the full Templates documentation for: Having issues?
I