Container Registries
A container registry is a store for Docker containers. A ZenML workflow involving a container registry automatically containerizes your code to be transported across stacks running remotely.Overview
When you run a pipeline with a container-based orchestrator (like Kubernetes, Kubeflow, or cloud services), ZenML:- Builds a Docker image containing your code and dependencies
- Pushes the image to your container registry
- Instructs the orchestrator to pull and run the image
When You Need a Container Registry
A container registry is required when using:- Kubernetes orchestrator
- Kubeflow orchestrator
- Vertex AI orchestrator
- SageMaker orchestrator
- Azure ML orchestrator
- Any other container-based orchestrator
- Local orchestrator
- Airflow orchestrator (unless using KubernetesPodOperator)
Available Container Registries
Default Container Registry
A simple registry that works with any Docker registry without additional configuration. Configuration:docker login on the machine running ZenML.
DockerHub Container Registry
Dedicated flavor for Docker Hub with built-in authentication support. Configuration:- Public image sharing
- Open source projects
- Quick prototyping
- Free tier for public repositories
Google Container Registry (GCR)
Google Cloud’s container registry service. Installation:- GCP-based infrastructure
- Integration with Vertex AI
- Google Cloud ecosystem
- Multi-region replication
Azure Container Registry (ACR)
Microsoft Azure’s container registry service. Installation:- Azure-based ML infrastructure
- Integration with Azure ML
- Enterprise Azure deployments
- Geo-replication requirements
Amazon Elastic Container Registry (ECR)
AWS’s container registry service. Installation:- AWS-based infrastructure
- Integration with SageMaker
- EKS deployments
- Cross-region replication
GitHub Container Registry
GitHub’s container registry service, integrated with GitHub repositories. Configuration:- GitHub-based workflows
- Open source projects
- CI/CD integration with GitHub Actions
- Free for public repositories
Choosing a Container Registry
| Registry | Best For | Key Features | Cost |
|---|---|---|---|
| Docker Hub | Quick start, public projects | Simple, widely supported | Free tier available |
| GCR/GAR | GCP infrastructure | GCP integration, global | Pay per GB stored |
| ECR | AWS infrastructure | AWS integration, private | Pay per GB stored |
| ACR | Azure infrastructure | Azure integration, geo-replication | Pay per GB stored |
| GitHub | GitHub workflows | GitHub integration, CI/CD | Free for public repos |
Image Building
Automatic Image Building
ZenML automatically builds Docker images when you run a pipeline:Custom Docker Configuration
You can customize the Docker build:Build Strategies
ZenML supports different build strategies: Local builds (default):Image Management
Image Naming
ZenML uses a consistent naming convention:Image Caching
ZenML caches Docker layers to speed up builds:- Only rebuilds when code or dependencies change
- Reuses base images across pipelines
- Supports Docker BuildKit for faster builds
Image Cleanup
Clean up old images to save storage:Security Best Practices
Use Service Connectors
Prefer service connectors over hardcoded credentials:Scan Images for Vulnerabilities
Use container scanning tools:- Trivy:
trivy image <image-name> - Snyk:
snyk container test <image-name> - Cloud provider tools: GCR Vulnerability Scanning, ECR Image Scanning, ACR Defender
Use Private Registries
For production workloads:- Keep images in private registries
- Use IAM/RBAC for access control
- Enable audit logging
- Implement image signing
Minimize Image Size
Troubleshooting
Authentication Failures
Build Failures
Push Failures
Next Steps
Orchestrators
Configure pipeline orchestration
Model Deployers
Deploy models for inference
