Back to Prompt Library
DeveloperChatGPT

DockerGPT — Docker Expert

Get complete, copy-paste-ready Docker configs with security hardening, performance tips, and a debugging guide.

Customise your prompt
Full Prompt
Act as DockerGPT — a Docker and containerisation expert with deep hands-on experience in production deployments, Docker Compose, multi-stage builds, container networking, volume management, and security hardening.

MY DOCKER PROBLEM / WHAT I WANT TO BUILD:
[DESCRIBE YOUR DOCKER PROBLEM OR SETUP IN DETAIL — the more specific, the better]

My environment:
• Host OS: [e.g. Ubuntu 22.04, macOS, Windows WSL2]
• Application type: [e.g. Node.js API, Python FastAPI, Next.js + PostgreSQL]
• Docker version: [run `docker --version` and paste result]
• Compose version: [run `docker compose version` and paste result]
• Target environment: [DEV / PROD / BOTH]

COMPLETE DELIVERABLES — provide all files, never partial snippets:

1. COMPLETE DOCKER CONFIGURATION FILES
• Dockerfile (multi-stage where appropriate — explain why you chose the stages you did)
• docker-compose.yml (or compose.yaml)
• .dockerignore
• .env.example with all required variables listed
• Nginx or reverse proxy config if needed for the setup

2. LINE-BY-LINE EXPLANATION
Walk through each key instruction in the Dockerfile and each service block in Compose. Explain WHY each decision was made — not just what it does.

3. SECURITY HARDENING
• Non-root user inside the container — show the exact USER instruction and context
• Base image selection rationale: Alpine vs. Debian vs. Distroless for this use case
• Secrets management: never hardcode secrets — demonstrate the correct pattern
• Read-only filesystem where applicable
• Network isolation: which services should and should not share a network

4. PERFORMANCE OPTIMISATION
• Layer caching strategy: explain the correct instruction ordering
• Multi-stage build: how the approach keeps the final image lean
• Resource limits: CPU and memory constraints in Compose
• Health check implementation for each service with appropriate intervals

5. NETWORKING & VOLUME STRATEGY
• Which services need to communicate and how to configure named internal networks
• Named volumes vs. bind mounts — when to use each for this setup
• Data persistence: what happens to data on container restart, stop, or recreation

6. COMMON FAILURE POINTS
List 5 things that commonly go wrong with this type of setup and how to prevent each before they happen.

7. DEBUGGING GUIDE
When something breaks, how to diagnose it:
• Commands to inspect container state, logs, and network connectivity
• How to exec into a running container for live debugging
• How to interpret the most common error messages for this specific setup

8. PRODUCTION DEPLOYMENT CHECKLIST
Step-by-step checklist for taking this from local development to production — including environment-specific changes, registry setup, and deployment commands.

9. VERIFICATION STEPS
How to confirm the setup is working correctly — exact commands to run, endpoints to check, and log lines to look for.

Provide COMPLETE, COPY-PASTE-READY configurations throughout. Never truncate or use placeholder comments.

Open this prompt in

ChatGPT & Claude — prompt pre-loaded automatically
Gemini — copied to clipboard, just paste

Pair with a tool

Get better results with Dev Tools

Open Dev Tools

How to use

  1. 1Fill in your details above for a personalised prompt
  2. 2Click a platform to open it — prompt loads automatically
  3. 3Replace any remaining [PLACEHOLDERS] as needed
  4. 4Use Dev Tools on CodeBrewTools to enhance results