Template configuration options
When creating a template, you’ll configure several key components: Name: The display name for your template that will appear in the template browser. Choose a descriptive name that clearly indicates the template’s purpose and contents. Container image: The path to the Docker image that forms the foundation of your template. This is where the core functionality of your template resides, including all software packages, dependencies, and files needed for your workload. You can import the image from:- A public registry like Docker Hub (e.g.,
ubuntu:latest
,pytorch/pytorch:latest
). - Your own private registry (requires registry credentials).
- NVIDIA GPU: For GPU-accelerated workloads requiring CUDA support
- AMD GPU: For workloads optimized for AMD graphics processors
- CPU: For CPU-only workloads that don’t require GPU acceleration
- Simple bash commands:
bash -c 'mkdir /workspace && /start.sh'
- JSON format with entrypoint and cmd:
{"cmd": ["python", "app.py"], "entrypoint": ["bash", "-c"]}
Most Docker images have built in start commands, so you can usually leave this blank. When customizing your start command, make sure you’re not overriding existing commands that are critical for the image to run.
- Container disk size: The amount of storage allocated for the container’s filesystem, including the operating system and installed packages.
- Volume disk size: Additional persistent storage that will be mounted to your Pod. This storage persists between Pod restarts and can be used for data, models, and other files you want to preserve.
- Volume mount path: The directory path where the persistent volume will be mounted inside the container (commonly
/workspace
).
- HTTP ports: Ports that will be accessible via Runpod’s HTTP proxy for web interfaces and APIs. These are automatically secured with HTTPS and accessible through Runpod’s proxy URLs.
- TCP ports: Direct TCP port access for services that require raw TCP connections, such as SSH, databases, or custom protocols.
- Configuration settings specific to your application.
- API keys and credentials (consider using Secrets for sensitive data).
- Runtime parameters that customize your template’s behavior.
Creating templates
The Runpod console provides an intuitive interface for template creation:
- Navigate to the Templates section.
- Click New Template.
- Fill in the configuration options described above.
- Click Save Template to save it to your account.
- Test your template by deploying a Pod to ensure it works as expected.
Using environment variables in templates
Environment variables provide a flexible way to configure your Pod’s runtime behavior without modifying the container image.Defining environment variables
Environment variables are key-value pairs that become available inside your Pod’s container. When creating a template, you can define variables by specifying:- Key: The environment variable name (e.g.,
DATABASE_URL
,API_KEY
). - Value: The value assigned to that variable.
Use cases for environment variables
Environment variables are particularly useful for:- Configuration settings: Database connections, API endpoints, feature flags.
- Runtime parameters: Model paths, batch sizes, processing options.
- Integration credentials: API keys, authentication tokens (consider using Secrets for sensitive data).
- Application behavior: Debug modes, logging levels, output formats.
Runpod system environment variables
Runpod automatically provides several predefined environment variables in every Pod, for example:RUNPOD_POD_ID
: Unique identifier for your Pod.RUNPOD_API_KEY
: API key for making Runpod API calls from within the Pod.RUNPOD_POD_HOSTNAME
: Hostname of the server running your Pod.