Edit Docker image & configuration
How to setup your Vast.ai instance
Vast.ai rents out 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 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.
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.
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:
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.
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.
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.
5555 is accessible as 41065
It is also possible to change environment variables. For example:
Sets the environment variable for time zone to UTC so that the instance is now in the UTC time zone.
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.
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 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.
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.
In most operating systems, double clicking on the certificate will start an installation wizard.
- 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.
- 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.
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.
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.
After checking the box for SSH direct connection, your search will be limited to machines with open ports. Checking that option will then create a second SSHD on an open port that you can connect directly to for a faster connection.
With the SSH direct option enabled, the direct SSH connection command will be displayed on the instance card, including the correct port and IP address of the Vast instance.
The proxy SSH connection will also still be available as a backup.
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.
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.
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.