Docker and Container Best Practices

DevOpsdevopsdockercontainerssecurity

Docker best practices with multi-stage builds, security hardening, compose setup, and performance optimization.

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

What you get when you save this prompt

Your workspace unlocks powerful tools to iterate and improve.

AI OPTIMIZE

AI Optimization

One-click improvement with structure analysis and pattern suggestions.

VERSION DIFF

Version History

Track every edit. Compare versions side-by-side with word-level diffs.

ORGANIZE
Development
Code Review
Testing
Marketing

Folders & Tags

Organize your library with nested folders, tags, and drag-and-drop.

MCP
$ npm i -g @promptingbox/mcp
Claude · Cursor · ChatGPT

Use Everywhere

Access prompts from Claude, Cursor, ChatGPT & more via MCP integration.

Your prompts, organized

Save, version, and access your best prompts across ChatGPT, Claude, Cursor, and more.