Use a Custom Container Image
Overview
You can use any public Debian image as the starting point for a project environment.
NVIDIA provides default base images, but you can use others images through the Custom Container feature. This feature only works with images that have some AI Workbench specific metadata fields.
You must attach the metadata to the image through “image labels”.
If an image lacks those fields, you can add them by rebuilding it with a containerfile. Then you push the container to a registry and use it when you create a new project.
You don’t need to add all possible image labels, but the more the better.
AI Workbench has basic required image labels just to pull and build the base images. The recommended and optional labels enable AI Workbench to add things to the base image.
- Required: Pull and build the labeled image
- Recommended environment: Enables adding image layers through scripts and package lists
- Recommended application: Enables managing applications already in the image
- Optional environment: Add package managers like conda or use virtual environments
Key Concepts
Container Registry
A service that stores and distributes container images. Examples are NVIDIA NGC, GitHub Container Registry and DockerHub. AI Workbench downloads base images from a registry.
Image Labels
Metadata key-value pairs added to a container image with the LABEL command.
AI Workbench reads these labels to know what is in the base image.
Containerfile or Dockerfile
A script that provides instructions to build a container image.
You use it to add labels with the LABEL command.
Use a Custom Container
Prerequisites: A URL for a public container image with at least the required image labels.
If the container does not have these, AI Workbench will not pull and build it.
Step One: Create a new project.
- Select Location Manager > Location Card
- Select Location Window > New Project
Step Two: Fill in project details.
- Enter New Project > Name (lowercase alphanumeric and hyphens)
- (optional) Enter New Project > Description
- (optional) Alter the default path New Project > Path
- Click New Project > Next
Step Three: Select your custom container.
- Select Custom Container
- Enter the full container URL:
registry.example.com/namespace/image:labeled - Select Create
Success: The project tab opens and the container starts building.
Custom Build Labels
Step One: Pull the unlabeled image and start a terminal in the container.
-
Pull the image from the registry and namespace with the command:
-
Start a bash terminal in the container with the command:
Step Two: Verify and locate Linux distribution and environment information in the container.
-
Find the distribution and release number with the command:
-
Verify Python is installed in the container
-
Find the path to pip with the command:
-
Find the path to apt with the command:
-
Detect the installed CUDA version with the command:
-
Keep the values as
<distro>,<distro-release>,<pip-path>,<apt-path>and<cuda-version>
Step Three: Create the Dockerfile.
-
Exit the container shell and get back on your local system
-
Create a local folder for the Dockerfile and create it there
Step Four: Enter the base image, required labels and the recommended labels in the Dockerfile.
Step Five: Rebuild the container using the Dockerfile.
Step Six: Tag the rebuilt image and push it to the public repository.
-
Add a tag to indicate the image is labeled with the command:
-
Push the image to the repository with the command:
Application Labels
Add these labels to add any existing application in the image to the Application Launcher.
You don’t need to add this information to the image because you can do it through the Desktop App after the project is created. However, image labels ensure things are setup without you needing to configure it each time you use the image.
Step One: Verify the application is in the image and .
-
Specify the application name, type, and class
-
Add the command to start the application
Step Two: Add webapp-specific labels.
-
For web applications, specify the port and URL configuration
-
Set autolaunch to true if the app should open automatically
Step Three: (Optional) Add health check and stop commands.
-
Add a command to verify the application is running
-
Add a command to stop the application gracefully
Success: Your application will appear in the AI Workbench Application Launcher.
Optional Labels
Add these labels to add any existing application in the image to the Application Launcher.
You don’t need to add this information to the image because you can do it through the Desktop App after the project is created. However, image labels ensure things are setup without you needing to configure it each time you use the image.
(optional) Add user information labels to use a specific user during the build or at runtime.
-
Add these labels to the Dockerfile if there is a user you want available in the running container
(optional) Add notable packages already installed by package manager.
-
Add these labels to make sure they are displayed in the project environment in the Desktop App
If your container uses a virtual environment or Conda environment: