Setting Up SSH Access
To enable SSH access for your image, theopenssh-server package must be installed. Many images do not include this package by default and require manual installation. There are three methods to include it in your template:
- Create a new image using your base image and upload it to Docker Hub.
- Modify your existing pipeline by adding an installation script to the
Dockerfile. - Install it during instance provisioning (not recommended due to performance impact).
- New Image
- Existing Dockerfile
- Runtime Installation (Not Recommended, Slow)
If you do not have an existing Dockerfile, you must create one. For example, if you wish to use the PyTorch 2.9.0 official image as your base, your Dockerfile should contain the following:Ensure that Docker is installed on your system. If not already authenticated, log in to Docker Hub:To build your Docker image, execute the following command:Push your image to Docker Hub:Once your image is successfully pushed and available on Docker Hub, you can reference it as the Image Name in your template configuration.This configuration ensures that both
Dockerfile
If you are using a different architecture than x86_64 (e.g., ARM64 for Apple Silicon), you may encounter an
InvalidBaseImagePlatform error.To resolve this issue, specify the target platform using the --platform linux/amd64 argument:Configure Template Startup Script
In the Advanced section of your custom template dialog, configure the Container Start Script as follows:PUBLIC_KEY and SSH_PORT environment variables are properly injected during the provisioning process.Environment Variables
Configure the following environment variables in your template settings to customize SSH access:| Variable | Description | Example Value |
|---|---|---|
SSH_PORT | Custom SSH port | 1234 |
PUBLIC_KEY | Your SSH public key for authentication | ssh-rsa AAAAB3NzaC1yc2E... |

Connecting via SSH
Once your Pod is running with SSH properly configured, establish a connection using the following command:While
root is the default user for most images, this may vary depending on your base image. Ensure that the user specified in your SSH connection matches the system user configured within your container image.Testing Your Image Locally
To test your image locally, verify that the SSH service functions correctly before deploying to production. First, create the startup script file:custom_start_script.sh
- Test Built Image
- Test Docker Hub Image
If you built your image locally using a Then run the container with the following command:
Dockerfile, first build the image:Replace
your-public-key with your actual SSH public key content (e.g., ssh-rsa AAAAB3NzaC1yc2E...).The private key file must have permissions set to
600 (or 400 on some systems) for SSH to accept it. You can set this using: