GPU Instances

Templates

18min

Vast.ai provides Linux docker instances. One key step during setup is specifying what Linux docker image to load. You can also specify Docker run commands, an on-start script that executes bash commands on instance start and a launch mode to help setup ssh or jupyter connect to the instance.

The instance configuration menu is accessible in the upper left of the create instance interface. The current options are always displayed in the upper left. Click on the EDIT IMAGE & CONFIG button to bring up config menu.

Document image


Docker image configuration

Vast has a number of popular preselected Docker images such as Pytorch and Tensorflow that will load fast on host machines. Each slot is customizable. Click on the SELECT text to select that slot and then click SELECT again to open the options for that slot.

Specify a Docker image

Enter the Docker image:tag from the Docker pull command. The interface will attempt to load the version tags from Docker hub and provide them as selections. As an example, to load the Ubuntu image with the latest tag the command would be:

Text


Docker repository (registry) authentication

Vast can connect to a custom docker repository and authenticate to that registry. Enter the registry information along with your username and password by scrolling down to the appropriate section.

Docker create/run options

Vast supports port and environment variables from docker run options. These can be input into the line after the Docker docker image line. It is most useful for opening custom ports on the instance so they are available when the instance is created. It requires creating the instance on a machine that has open ports. If a direct launch mode is selected, the interface will filter for only machines with open ports.

To expose a port, add the port command to the docker run options line.

Text


Adding that command to the run options would open port 5555 on the instance which will be mapped to an accessible external port on the machine. To find the mapped port, open the IP&Port info link on the instance after it is running.

Document image


It is also possible to change environment variables. For example:

Text


Sets the environment variable for time zone to UTC so that the instance is now in the UTC time zone.

Select a launch mode

Vast provides a "launch mode" for the docker image which sets up SSH or Jupyter for connecting to the instance instead of a normal entrypoint process. After the instance starts, the GUI provides the SSH command or Jupyter link to connect to the instance.

Also supported is a normal ENTRYPOINT process which allows you to configure a docker run command and pass arguments. Unless you know you intend to use a docker ENTRYPOINT, you probably want the ssh launch type with an onstart script.

Direct vs proxy connections

Vast offers both proxy (default) and direct connection methods for SSH and Jupyter launch modes. In general, the proxy connections use a Vast proxy server and work on machines without open ports. The proxy connections are slower for data transfer.

The direct connections only work on machines with open ports. When selected, the instance will open port 22 and/or 8080 when created. These direct launch modes are the preferred methods to connect and allow direct connections to the instance. Data transfer is faster and the connection is more reliable. Also because the machine has open ports, it is possible to copy data off the instance when it is stopped to local or another instance using the Vast CLI copy command.

Jupyter

Jupyter is an interactive notebook interface that is very popular for AI/ML development using Python. Using Jupyter, you can connect to an interface in your browser and open any notebook that you can download as a .ipynb file.

We recommend this launch mode to start. We also recommend this launch mode over trying to run Google Colab with Vast. While Google Colab has a way to connect to a "local runtime", running Jupyter directly is more robust and less error prone if connections drop or the browser window is closed.

By default Jupyter instances use a proxy server. This is a simple setup that works on machines with or without open ports. The only downside is it can be slower to upload/download large files.

Jupyter direct HTTPS launch mode

When selecting Jupyter there is a check box for "Jupyter direct HTTPS". When you select this box, you are then limiting your search to machines that have open ports, as you cannot run this option on machines without open ports. So your machine search will narrow.

Jupyter uses a browser interface, so to get the direct HTTPS connection to work, you will need to install a certificate onto your operating system.

If you don't install the browser certificate, Windows and Linux will show a "Your connection is not private" Privacy error. It is annoying but you can click through by clicking "Advanced" and then proceed.

If you don't install the certificate on macOS, the OS might not let you open the Jupyter webpage.

Installing the TLS certificate

Start by downloading the certificate here. Then follow the directions for your operating system.

In most operating systems, double clicking on the certificate will start an installation wizard.

Windows

  1. After downloading the certificate, double click on it to open the installation wizard.
  2. Click "Open".
  3. Click on the "Install Certificate" button. Select either the current user or local machine and hit next.
  4. Click "Place all certificates in the following store".
  5. Select the folder "Trusted Root Certification Authorities". Click OK. Then click Next. Click "Finish" to install the certificate.
  6. Reboot the machine so the change can take effect.

macOS

  1. Double click the certificate after downloading it. It will then be added to your Keychain under the Login default keychain. You will notice that it is not trusted.
  2. Double click the entry and then click on the "Trust" box.
  3. Change the "When using this certificate" box to "Always Trust".
  4. Close the window.

SSH

Select this launch mode to connect to your instance using SSH. Once your instance is rented and starts, you will be given an SSH command that will have the right ports, hostname and settings to connect to your Vast instance.

On Ubuntu or Mac, first you need to generate an rsa ssh public/private keypair using the command:

Text


Next you may need to force the daemon to load the new private key, and confirm it's loaded:

Text


Then get the contents of the public key with:

Text


Copy the entire output to your clipboard, then paste that into the "Change SSH Key" text box under console/account. The key text includes the opening "ssh-rsa" part and the ending "user@something" part. If you don't copy the entire thing, it won't work.

example SSH key text:

Text


You can use a few SSH keys by pasting in each on a new line into the account page.

The default SSH connection is made using a proxy. This method is slower, as it involves a bounce server, but it works on machines without open ports.

For Windows users, read our [Windows guide](/docs/guides/gpu_instances/SSH#windows-sshscp-video-guide) on how to use Putty tools to SSH into a Vast instance.

SSH Direct

This launch mode allows you to SSH directly into the instance. The speed of the connection is then only limited by your local machine's connection and the connection speed displayed on the instance card. The proxy SSH connection information is given as a backup, but it is typically slow.

On-start scripts

For both Jupyter and SSH launch modes, you can paste in a script that will run Bash commands after the machine starts. Add a semicolon ; at the end of each command.

Entrypoint

This allows you to configure a docker run command with a normal ENTRYPOINT process, instead of setting up ssh and remote access. You will not be able to retrieve the command's output. Unless you know you intend to use a docker ENTRYPOINT, you probably want the ssh launch type with an onstart script.

Select Disk Size

When the instance is created, the disk size is set and cannot be modified. It is important to estimate how much disk you will need and then to move the slider to the desired disk size. The default disk size for an instance is 10GB. Use the slider to allocate more or less, taking into consideration that providers charge for disk allocation even when the instance is stopped.

Updated 07 Jul 2023
Doc contributor
Did this page help you?