Creating a Custom Template
You can create a template with your own docker image after reading this guide for most use cases.
Vast instances are currently Linux Docker containers. Many Linux based images should work within Vast. We will be enabling you to use instances that are Windows virtual machines and other kinds of virtual machines soon.
- A Vast.ai account
Once logged in, click on Templates to go to the template section. This is where you can create, manage, and edit templates.
Click the button + New to create a new template.

In the Image Path Tag, you can add the path/tag of the docker image you wish to use. The Version Tag is where you would set the version.

You can use the -e option to set environment variables in the Docker Options field by adding something like:
-e MYVAR1
You can also add environment variables one by one in the Environment Variables section. These entries will automatically sync with the Docker Options field.

These options will be appended to the docker run command before the docker run command is executed within one of the machines. Similar to how it would be if you were executing "docker run -e MYVAR1 IMAGE[|@DIGEST]" on your local machine.
In addition to setting environment variables, you can also open custom ports by adding -p ${HOST_MACHINE_PORT}:${CONTAINER_PORT} to the Docker Options section.
You can also add them to the Ports section. Once more, this will automatically sync with the Docker Options field.

You can see what's happening inside a container at particular port by finding the public ip address mapped to that container port.
Internally, one of the machine's open ports is mapped to this container port.
You can use ssh to open a ssh connection to the host machine's public ip address. The machine will forward traffic from the host machine's public port to the container port you specified.
You can use a ssh command like the one below.
You can choose the jupyter, ssh, or entrypoint launch mode depending on your needs.
These commands will be executed as soon the docker container starts, similar to how a bash script be would be executed suppose you created a bash script and added a CMD command in the Dockerfile so Docker would execute this bash script when the container starts.
- Before Vast
In this case: CMD specifies the default command to run when the container starts, which is your start.sh script.
- In On-Start Script Section With Vast:
You can also try to overwrite existing files built into the image. Make sure you can switch to a user that has write permissions to that particular file.
For example, you can remove all instances of '-sslOnly' in a particular file using sed.
You can also make directories.

Make sure to append environment variables to /etc/environment file in your on-start section because this makes environment variables available to all users and processes and ensures they are persisted even if your instance/docker container is rebooted. This code snippet will take care of this.
Also make sure to find the image’s ENTRYPOINT or CMD command and call that command at the end of the on-start section. We overwrite that command to set up jupyter/ssh server, etc. under the hood.
You don't have to specify docker.io as the server name if your repository is Docker Hub. Docker automatically uses docker.io to pull the image if no other registry is specified.
You do have to specify your server name if your repository is something else.
For example,
GitHub Container Registry (GHCR) - Server Name: ghcr.io
Google Container Registry (GCR) - Server Name: gcr.io
We will have the same character set for docker login usernames and passwords as Docker soon.



Choose whether to include ReadMe, make template public, and fill out readme if you desire.

A new template will be created when you edit, make changes, and save.

You can download and upload files: Copy Data To/From Instance Storage
You can also backup data to cloud storage: Backup Data to Cloud Storage
- If your image is built for a different CPU architecture than your Vast machine, then it won't work. You can try to find a machine with the required CPU architecture using our GUI or CLI. CLI Documentation Command to Search Offers Using CLI
- If your image requires a higher CUDA version, then look for a machine with a higher Max CUDA version. The Max CUDA version can be found on the instance card. How to Find Max CUDA version in Instance Card
- If your image is built to run jupyter, then try running it on a port different than 8080.
- If you are having issues using ssh launch mode, add your public key to ~/.authorized_keys, install openssh, start openssh when the container starts, and forward the ssh server's port.