Beyond Zero: Eliminating Vulnerabilities in PyTorch Container Images (PyTorch 2024)
Video and transcript of presentation at PyTorch 2024 on eliminating CVEs in the PyTorch image, drawing on best practices …
Product Docs
Open Source
Compliance
Education
The July 2025 Learning Lab with Patrick Smyth covers AI with Hardened Container Images. In this session, learn how to secure AI workloads by reducing vulnerabilities in container images by over 90%. Patrick demonstrates hands-on techniques for training an animal detection model using PyTorch with hardened container images, creating minimal and secure deployments, and running AI frameworks with zero CVEs.
In the demo, Patrick trains and runs inference on an image classification model using PyTorch and Chainguard’s hardened container image. The model classifies images of octopuses, whales, and penguins, demonstrating how to work with AI workloads securely.
Demo Repository: PyTorch Getting Started
First, create a directory for the project and download the necessary files:
mkdir -p ~/image_classification && cd ~/image_classification && \
curl https://codeload.github.com/chainguard-dev/pytorch-getting-started/tar.gz/main | \
tar -xz --strip=1 pytorch-getting-started-main/
Then run the training script inside a Chainguard PyTorch container:
docker run --user root --rm -it \
--platform linux/amd64 \
-v "$PWD/:/home/nonroot/octopus-detector" \
cgr.dev/chainguard/pytorch:latest \
"/home/nonroot/octopus-detector/image_classification.py"
This command generates a model file named octopus_whale_penguin_model.pt
.
To test the trained model, first download a test image:
curl https://raw.githubusercontent.com/chainguard-dev/pytorch-getting-started/main/inference-images/octopus.jpg > ~/image_classification/octopus.jpg
Then run the classification:
cd ~/image_classification && \
docker run --user root --rm -it \
--platform linux/amd64 \
-v "$PWD:/home/nonroot/octopus-detector" \
cgr.dev/chainguard/pytorch:latest \
"/home/nonroot/octopus-detector/image_classification.py" \
"/home/nonroot/octopus-detector/octopus.jpg"
The demo showcases how Chainguard’s hardened PyTorch image provides the same functionality as traditional images while eliminating vulnerabilities and reducing the attack surface.
Video and transcript of presentation at PyTorch 2024 on eliminating CVEs in the PyTorch image, drawing on best practices …
Learn how to use Chainguard's PyTorch container image for deep learning with enhanced security, minimal CVEs, and GPU …
Procedural tutorial outlining how to create a Chainguard identity that can be assumed by a Kubernetes pod.
Dustin Kirkland discusses whether users can build Chainguard Containers on their own
Interview with Dustin Kirkland about the products and artifacts created by the Chainguard Factory
Last updated: 2025-07-25 12:30