Install and Configure SSH and Jupyter for Custom Images

Learn how to configure SSH service and JupyterLab for nvcr.io/nvidia/pytorch:25.04-py3 image in Dev Pod

This example shows you how to configure SSH service and JupyterLab for a custom Docker image nvcr.io/nvidia/pytorch:25.04-py3 when using Dev Pod.

This PyTorch image doesn't come with SSH service and JupyterLab pre-configured, so manual setup is required for remote access and JupyterLab.

Step 1: Prepare the Setup Script

Create a setup script that will install and configure SSH service and JupyterLab on your PyTorch container. Here's the complete script template:

Configuration Parameters

Before running the script, configure the following parameters:

  • SSHPUB: Your SSH public key (e.g., ssh-rsa AAAxxxxx lepton@sampleDomain.com)
  • JUPKEY: Your JupyterLab token (optional, leave empty to skip JupyterLab installation)

Step 2: Create Dev Pod with PyTorch Image

  1. Navigate to Dev Pod Creation: Go to the Dev Pod creation page in your DGX Cloud Lepton dashboard.
  2. Select Custom Image: In the container configuration section, select custom image and input the image name nvcr.io/nvidia/pytorch:25.04-py3.
  3. Create the Pod: Complete the pod creation with your desired resource configuration.

Step 3: Run the Setup Script

  1. Open the Web Terminal: Navigate to your Pod details page and switch to the "Terminal" tab.
  2. Execute the Script: Copy the configured script from Step 1, paste it into the terminal, and press Enter.
  3. Wait for Completion: The script will automatically:
    • Install and configure SSH service on the PyTorch container
    • Set up SSH keys and authentication
    • Install and configure JupyterLab (if token provided)
    • Start the services

Step 4: Verify the Configuration

Verify SSH Setup

After the script completes successfully, verify that SSH is properly configured:

  1. Check SSH Directory: Ensure the .ssh directory exists in the root directory
  2. Check Authorized Keys: Verify that the authorized_keys file is present and contains your public key
  3. Test Connection: Use the SSH connection command from the Pod details page under the "Connect" tab

Verify JupyterLab

If you configured JupyterLab:

  1. Check Process: Verify that JupyterLab is running with pgrep jupyter-lab
  2. Check Logs: View JupyterLab logs at /var/log/jupyter.log
  3. Access Interface: Connect to JupyterLab through the Pod's network interface on port 18889

Verify PyTorch Environment

Once connected via SSH, you can verify the PyTorch environment:

What This Example Achieves

By following this example, you will have:

  • A fully configured SSH service on the PyTorch 25.04-py3 container
  • Key-based SSH authentication
  • JupyterLab running on port 18889 (optional)
  • Proper environment variable exposure for SSH sessions
  • Access to the complete PyTorch development environment
  • Security configurations optimized for container environments

This setup enables you to remotely access your PyTorch Dev Pod for machine learning development, model training, and interactive computing tasks with the full power of the NVIDIA PyTorch container.

Copyright @ 2025, NVIDIA Corporation.