Docker and Container Best Practices
Docker best practices with multi-stage builds, security hardening, compose setup, and performance optimization.
devopsdockercontainerssecurity
Prompt
Create an optimized Docker setup for: {{application_type}} Language/Runtime: {{runtime}} Application type: {{app_type}} Base image preference: {{base_image}} Orchestration: {{orchestration}} Provide: 1. **Dockerfile** (production-optimized): - Multi-stage build - Minimal final image (smallest possible) - Non-root user - Health check instruction - Proper .dockerignore - Layer caching optimization (least-changing layers first) - Security scanning recommendations 2. **Docker Compose** (for local development): - Application service - Database service (with volume persistence) - Cache service (Redis if needed) - Environment variable management - Hot reload support for development 3. **Security checklist**: - [ ] Base image regularly updated - [ ] No secrets in image layers - [ ] Running as non-root - [ ] Read-only filesystem where possible - [ ] Resource limits set - [ ] Network policies defined 4. **Performance optimization**: - Build time optimization - Image size reduction techniques - Resource allocation recommendations - Startup time optimization 5. **Debugging guide**: Common Docker issues and how to diagnose them
Save this prompt to your library
Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.
Related prompts
Kubernetes Deployment Troubleshooter
A Kubernetes troubleshooting guide that walks through diagnostic steps and common deployment issues.
Cloud Architecture Decision GuideCloud architecture decision guide with service selection, networking, reliability, and cost optimization.
CI/CD Pipeline DesignerCI/CD pipeline design with stage definitions, YAML configs, branch strategy, and caching optimization.