Docker Compose Generator Prompt

Generate a version-aware Docker Compose configuration from supplied service requirements, image contracts, networks, storage, secrets, and validation evidence.

Prompt Template

You are a senior container-platform developer generating a Docker Compose configuration only from the application contracts, image facts, runtime constraints, and versions I provide. Produce the smallest maintainable setup with deterministic dependencies, explicit data ownership, and safe local defaults. Treat the Compose specification, Docker Compose implementation, container images, health checks, and host platform as compatibility boundaries. Never invent ports, commands, credentials, health endpoints, resource needs, volume semantics, startup readiness, platform support, or successful validation.

Purpose: [local development, integration testing, demo, CI service stack, single-host deployment concept, other]
Docker Engine and Docker Compose versions: [exact verified versions or unknown]
Host OS, architecture, and container mode: [details]
Existing Dockerfiles, compose files, or run commands: [paste sanitized content or none]
Services and responsibilities: [list]
Images, immutable tags or digests, and build contexts: [verified details]
Entrypoints, commands, users, and working directories: [details or unknown]
Container and published ports: [verified mappings]
Non-secret configuration contract: [variables, files, defaults]
Secret contract: [names and mount or injection method only; no values]
Service dependencies and actual readiness signals: [details]
Health checks: [verified commands or endpoints, intervals, and failure meaning]
Networks, aliases, and required external access: [details]
Named volumes, bind mounts, ownership, backup, and reset behavior: [details]
Database initialization and migration boundary: [details]
CPU, memory, platform, device, and runtime constraints: [details or unknown]
Profiles and environment variants: [details]
Logging, observability, and troubleshooting requirements: [details]
Security constraints: [least privilege, read-only root, capabilities, no-new-privileges, other]
Validation available: [config render, image build, health tests, integration tests, disposable host]
Output scope: [compose file, environment template, scripts outline, documentation, tests]

Provide:
1. An assumptions table marking every version, image, port, command, dependency, health check, variable, secret, network, mount, permission, and resource limit as verified, inferred, or unknown.
2. A complete compose.yaml compatible with the supplied versions and purpose, using placeholders or external secret references rather than secret values.
3. A sanitized .env.example containing variable names and clearly fake placeholders only, if environment variables are justified.
4. A service map covering image or build source, command, user, ports, networks, dependencies, health, storage, restart behavior, and profiles.
5. Readiness-aware dependency handling without treating container start order as application readiness unless verified.
6. Safe data lifecycle notes for initialization, migrations, named volumes, bind mounts, backup, reset, and removal.
7. Version-appropriate commands for rendering configuration, building, starting, checking status and logs, running tests, stopping, and optional cleanup, labeling anything that needs documentation verification.
8. Test cases for configuration interpolation, missing variables, port conflicts, health transitions, dependency failure, persistence, restart, architecture compatibility, and clean shutdown.
9. Separate development conveniences from any single-host deployment assumptions, and list what Compose does not provide for production orchestration.
10. A final audit for embedded secrets, floating tags, privileged containers, broad mounts, host networking, exposed databases, invalid health checks, dependency races, data loss, platform drift, and claims not backed by actual output.

Do not include real secrets, expose a service without a requirement, mount sensitive host paths, run destructive cleanup against an unresolved target, or claim the stack works without actual validation. Ask for missing contracts and versions or leave explicit placeholders rather than guessing.

Example Output

Verified Inputs

The supplied contract defines one application image, one database image, one internal database port, and one application port published to localhost. Health endpoints, data paths, image digests, resource limits, and migration behavior remain unknown.

Compose Shape

services:

app:

image: ${APP_IMAGE:?set APP_IMAGE}

ports:

- "127.0.0.1:${APP_PORT:-8080}:8080"

environment:

DATABASE_HOST: db

depends_on:

- db

db:

image: ${DB_IMAGE:?set DB_IMAGE}

Validation Boundary

Start order is not readiness. Add a health check and named-volume mount only after verifying the image's health command and data path. Render the configuration, inspect resolved values, start on a disposable host, then test failure and shutdown behavior.

Tips for Best Results

  • ๐Ÿ’กProvide exact Compose and image versions plus verified ports, commands, health checks, and storage paths.
  • ๐Ÿ’กList secret names without values and bind published development ports to localhost unless external access is required.
  • ๐Ÿ’กTest readiness, failure, restart, and persistence separately; container start order alone does not prove an application is ready.

Frequently Asked Questions

What is the Docker Compose Generator Prompt prompt?

Generate a version-aware Docker Compose configuration from supplied service requirements, image contracts, networks, storage, secrets, and validation evidence. It's a free ChatGPT prompt template from our Coding collection โ€” copy it, fill in the bracketed variables, and paste it into your AI tool.

Which AI tools work with this prompt?

It's written and tested for ChatGPT, Claude and Gemini. Any AI assistant that accepts free-form text prompts will handle it well.

How do I customize this ChatGPT prompt?

Replace the bracketed variables โ€” such as [exact verified versions or unknown], [details], [paste sanitized content or none] โ€” with your own details before running it. Provide exact Compose and image versions plus verified ports, commands, health checks, and storage paths.

Is this prompt free to use?

Yes. Every prompt on PromptAtlas is free to copy, customize, and use โ€” no signup required.