Docker-Based Deployment
Docker provides a consistent, portable way to deploy ZenML server across different environments. This guide covers Docker deployment from development to production scenarios.Docker Images
ZenML provides official Docker images:Production Image
zenmldocker/zenml-server:latestOptimized production image with minimal footprintDevelopment Image
zenmldocker/zenml-server:devDevelopment image with debugging toolsAvailable Tags
Quick Start
Single Container Deployment
Run ZenML server with SQLite (development only):http://localhost:8080
Docker Compose (Recommended)
Createdocker-compose.yml:
Production Deployment
Docker Compose with MySQL
Production-ready setup with external database:Environment Variables File
Create.env file:
Configuration Options
Core Environment Variables
Database SSL Configuration
Secrets Store Configuration
AWS Secrets Manager
GCP Secret Manager
Azure Key Vault
Docker Image Architecture
Base Image Structure
The ZenML server image is built with security and efficiency in mind:Installed Dependencies
Production image includes:- ZenML server with FastAPI
- Database connectors (MySQL, PostgreSQL)
- Cloud secrets managers (AWS, GCP, Azure, HashiCorp)
- Cloud storage support (S3, GCS, Azure Blob)
- Service connectors
Image Variants
Production Image (zenml-server:latest)
- Minimal size (~500MB)
- No development tools
- Optimized for performance
- Runs as non-root user
zenml-server:dev)
- Includes debugging tools
- MySQL/MariaDB clients
- Network utilities
- Source code included
Advanced Deployment Patterns
Reverse Proxy with Nginx
nginx.conf):
Multi-Container Setup with Redis
Add caching layer:Resource Limits
Configure container resource constraints:Monitoring and Logging
Health Checks
Logging Configuration
Centralized Logging
Ship logs to external system:Backup and Recovery
Database Backup
Backup MySQL database:Volume Backup
Backup Docker volumes:Automated Backups
Add backup service to docker-compose:Security Best Practices
Run as Non-Root User
The ZenML image runs as userzenml:zenml (UID:GID 1000:1000):
Secrets Management
Use Docker secrets for sensitive data:Network Isolation
Troubleshooting
Container Won’t Start
Check container logs:Database Connection Issues
Test database connectivity:Permission Issues
Fix volume permissions:High Memory Usage
Monitor container resources:Maintenance Operations
Update to New Version
Database Migration
Migrations run automatically on startup. To run manually:Clean Up Resources
Performance Optimization
Connection Pooling
Resource Allocation
Next Steps
Kubernetes Deployment
Scale to production with Kubernetes
Configuration Guide
Advanced server configuration
Custom Docker Builds
Build custom ZenML images
