Docker Containerization Best Practices
Comprehensive containerization framework with 60+ rules across Dockerfile optimization, multi-service orchestration, production deployment, and development workflows. Designed for reliable, scalable container deployments from development to production.
When to Apply
Reference these guidelines when:
- Containerizing Django, FastAPI, or Celery applications
- Setting up multi-service architectures with Docker Compose
- Implementing production deployment pipelines
- Managing development environments consistently
- Scaling containerized applications
- Optimizing container performance and security
Rule Categories by Priority
| Priority | Category | Impact | Files Created | Prefix |
| --- | --- | --- | --- | --- | --- |
| 1 | Container Fundamentals | CRITICAL | 4 | dockerfile- |
| 2 | Docker Build | CRITICAL | 4 | build- |
| 3 | Application Containers | CRITICAL | 5 | app- |
| 4 | Docker Compose | HIGH | 8 | compose- |
| 5 | Orchestration | HIGH | 3 | swarm- |
| 6 | Security | HIGH | 3 | security- |
| 7 | Production Deployment | HIGH | 2 | deploy- |
| 8 | Observability | MEDIUM | 3 | logging- |
| 9 | Development Workflow | MEDIUM | 2 | dev- |
| 10 | Infrastructure | MEDIUM | 3 | infra- |
| 11 | Advanced Features | LOW | 3 | advanced- |
Quick Reference
1. Container Fundamentals (CRITICAL)
dockerfile-security: Secure base images and vulnerability scanningdockerfile-optimization: Multi-stage builds and layer cachingdockerfile-best-practices: Proper user management and signal handlingimage-management: Tagging strategies and registry usage
2. Docker Build (CRITICAL)
build-buildx: Advanced build features with Buildxbuild-multiplatform: Cross-platform image buildingbuild-cache: Build caching for faster buildsbuild-security: Secrets, SSH, and attestations in builds
3. Application Containers (CRITICAL)
app-django: Django containerization with static files and migrationsapp-fastapi: FastAPI async containerization with Uvicornapp-celery: Celery containerization with broker integrationapp-database: Database containerization with persistenceapp-redis: Redis containerization for caching and data structures
4. Docker Compose (HIGH)
compose-development: Development environment orchestrationcompose-production: Production-ready service compositioncompose-networking: Service communication and isolationcompose-volumes: Data persistence and sharingcompose-configs-secrets: Configuration and secrets managementcompose-multiple-files: Multiple compose files and includescompose-environment: Environment variables and interpolationcompose-cli-advanced: Advanced CLI commands and project management
5. Orchestration (HIGH)
swarm-setup: Docker Swarm cluster managementswarm-services: Swarm service deployment and scalingswarm-networking: Swarm overlay networking and security
6. Security (HIGH)
security-scanning: Docker Scout vulnerability scanningsecurity-hardening: Container runtime security hardeningsecurity-compliance: Security compliance and best practices
7. Production Deployment (HIGH)
deploy-registry: Container registry management and securitydeploy-scaling: Horizontal scaling and load balancing
8. Observability (MEDIUM)
logging-drivers: Docker logging drivers and configurationlogging-aggregation: Log aggregation and monitoringlogging-troubleshooting: Debugging and troubleshooting containers
9. Development Workflow (MEDIUM)
dev-hot-reload: Development with live code reloadingdev-testing: Testing in containerized environmentsdev-debugging: Container debugging and troubleshootingdev-testing: Testing in containerized environments
10. Infrastructure (MEDIUM)
infra-networking: Container networking patternsinfra-security: Container runtime securityinfra-storage: Persistent storage and backups
11. Advanced Features (LOW)
advanced-desktop: Docker Desktop features and developmentadvanced-context: Docker context managementadvanced-api: Docker API and programmatic access
Quick Start
- 📖 Overview:
skills/docker-skill/SKILL.md - 📚 Complete Reference:
skills/docker-skill/AGENTS.md - 🔍 Specific Rules:
skills/docker-skill/rules/[category]-[rule-name].md
| Total | 11 Categories | | 42 Files | 170+ Rules | |