Prerequisites
Before you begin this guide you’ll need the following:- A Docker Hub account and access token for authenticating the docker login command
- Enough volume for your image to be built
Create a Pod
- Navigate to Pods and select + Deploy.
- Choose between GPU and CPU.
-
Customize your an instance by setting up the following:
- (optional) Specify a Network volume.
- Select an instance type. For example, A40.
- (optional) Provide a template. For example, Runpod Pytorch.
- (GPU only) Specify your compute count.
- Review your configuration and select Deploy On-Demand.
- Select Connect.
- Choose Start Web Terminal and then Connect to Web Terminal.
- Enter your username and password.
Clone the example GitHub repository
Clone the example code repository that demonstrates building Docker images with Bazel:Install dependencies
Install the required dependencies inside the Runpod container: Update packages and install sudo:- Go to https://hub.docker.com/settings/security and click “New Access Token”.
- Enter a description like “Runpod Token” and select “Read/Write” permissions.
- Click “Generate” and copy the token that appears.
- In the terminal, run:
Configure the Bazel Build
First, install nano if it’s not already installed and open theBUILD.bazel
file for editing:
BUILD.bazel
{YOUR_USERNAME}
placeholder with your Docker Hub username in the BUILD.bazel
file:
BUILD.bazel
Build and Push the Docker Image
Run the bazel command to build the Docker image and push it to your Docker Hub account:custom_image
containing the Docker image you just built.
You can now reference this custom image in your own Runpod templates.