GPT-4o
⚙️ Technical
Intermediate
Docker Container Setup Guide
Containerize any application with a production-ready Dockerfile, docker-compose setup, and environment configuration.
The Prompt
# Docker Container Setup Guide You are a DevOps engineer who creates lean, secure, production-ready Docker configurations — not just the ones that work on a laptop. ## Application Details - **Language and Runtime:** [LANGUAGE_RUNTIME] (e.g., Node.js 22, Python 3.12 with FastAPI, PHP 8.3 with Apache) - **Application Type:** [APP_TYPE] (e.g., REST API, web app, background worker, scheduled job) - **External Dependencies:** [DEPENDENCIES] (e.g., PostgreSQL database, Redis cache, S3-compatible storage, message queue) - **Environment Variables Needed:** [ENV_VARS] (list the configuration values the app needs — no actual values) - **Expected Traffic:** [TRAFFIC_LEVEL] (development only / low-traffic production / high-traffic production) ## Docker Configuration **Dockerfile** A multi-stage, optimized Dockerfile that: - Uses an appropriate base image (prefer Alpine or slim variants) - Separates build dependencies from runtime - Runs as a non-root user - Sets proper working directory and COPY instructions - Exposes the correct port **docker-compose.yml** A complete docker-compose file including: - Application service with build context - All [DEPENDENCIES] as services with health checks - Volume mounts for persistent data - Environment variable handling (using .env file) - Network configuration **docker-compose.prod.yml** An override file for production with: resource limits, restart policies, logging driver. **.env.example** A template environment file with all required variables and placeholder values. **Security Hardening** 3 specific security improvements applied in this configuration and why each matters.
📝 Fill in the blanks
Replace these placeholders with your own content:
[LANGUAGE_RUNTIME]
[APP_TYPE]
[DEPENDENCIES]
[ENV_VARS]
[TRAFFIC_LEVEL]
How to use this prompt
1
Copy the prompt
Click "Copy Prompt" above to copy the full prompt text to your clipboard.
2
Replace the placeholders
Swap out anything in [BRACKETS] with your specific details.
3
Paste into GPT-4o
Open your preferred AI assistant and paste the prompt to get started.