Skip to main content

Claude Prompt for a Docker Compose Development Environment

Create a complete docker-compose.yml for local dev with hot reloading, database, cache, and auxiliary services wired for fast onboarding.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt
Build a docker-compose.yml for local development of my Full-stack web application application. The stack requires app server, PostgreSQL, Redis, MinIO for S3-compatible storage. 1) Application service: mount source code as a volume for hot reloading, expose port 3000, configure env_file referencing .env.local with docker-specific overrides for environment variables. 2) Database service: PostgreSQL 16 with persistent volume, initialization scripts for schema and seed data, health check that waits for the DB to accept connections. 3) Cache service: Redis 7 with appropriate memory limits and eviction policy. 4) Add MailHog for email testing, pgAdmin for database management with proper networking and dependency ordering using depends_on with health check conditions. 5) Configure a shared network with proper DNS resolution between services. 6) Add volume definitions for persistent data and named volumes for package caches. 7) Create profiles for optional services (monitoring, email testing) that only start when explicitly requested. 8) Include a Makefile or shell script with common commands: start, stop, logs, shell, reset-db, seed.

What this prompt does

This prompt builds a complete docker-compose.yml for local development of your [project_type] application, wiring the services in [services] so a new project comes up with a single command. The application service mounts source code as a volume for hot reloading, exposes port [app_port], and configures environment variables via [env_strategy], so day-one onboarding is fast instead of a scavenger hunt.

The structure works because it brings the whole stack up together and keeps every piece healthy. The [database] service gets a persistent volume, initialization scripts for schema and seed data, and a health check that waits until the database accepts connections. The [cache] service uses [cache] with appropriate memory limits and an eviction policy. It adds [auxiliary_services] with proper networking and dependency ordering via depends_on using health-check conditions, a shared network with DNS resolution between services, named volumes for persistent data and package caches, and profiles so optional services like monitoring and email testing only start when explicitly requested. It also includes a Makefile or shell script with common commands such as start, stop, logs, shell, reset-db, and seed. Keeping optional services behind profiles is what keeps day-to-day work fast while the extras stay one command away.

When to use it

  • You want a new project to come up with one command for fast onboarding.
  • You need a local database with persistent data, schema, and seed scripts.
  • You want hot reloading via a mounted source volume.
  • You need auxiliary services like mail testing or DB admin without slowing daily work.
  • You want health-check-based startup ordering so services wait for their dependencies.
  • You want common operations wrapped in a Makefile or shell script.

Example output

Expect a ready-to-run local environment, not a fragment. You get a docker-compose.yml with an app service that has a source volume and port [app_port], a [database] service with a persistent volume, init scripts, and a connection health check, a [cache] service with memory limits and eviction, and the [auxiliary_services] placed behind profiles. It also defines a shared network, named volumes for data and package caches, and a Makefile with start, stop, logs, shell, reset-db, and seed targets, so the whole stack is reproducible for the next developer who clones the repo.

Pro tips

  • List exactly what you need in [services], since an unused service in the compose file just slows startup for everyone.
  • Use [env_strategy] with an env_file plus docker-specific overrides so secrets stay out of the compose file itself.
  • Keep optional tooling behind profiles so everyday work stays fast and monitoring or mail testing start only when requested.
  • Give the [database] a real connection health check so dependent services wait instead of crashing against a cold database.
  • Use named volumes for package caches so installs do not re-download on every rebuild and onboarding stays quick.
  • Keep the Makefile commands like reset-db and seed, since they are what make the environment reproducible for the next developer.

Frequently Asked Questions

Does hot reloading work through Docker Compose?
Yes, by mounting your source as a volume so changes on the host appear inside the container. The app service is configured this way. Performance varies by platform, and on some systems bind-mount file watching needs polling enabled to detect changes reliably.
Why put some services behind profiles?
Profiles let optional services like monitoring or `[auxiliary_services]` such as MailHog start only when explicitly requested. This keeps everyday startup fast and lightweight while the extra tooling stays available for the moments you actually need it.
How does the database avoid race conditions on startup?
The `[database]` service includes a health check that waits until it accepts connections, and dependent services use depends_on with health conditions. This prevents the app from starting against a database that is still booting, which otherwise causes confusing cold-start crashes.
What does the Makefile add over raw compose commands?
It wraps common operations like start, stop, logs, shell, reset-db, and seed into short, memorable commands. This makes the environment reproducible and lowers the onboarding curve, since a new developer runs one command instead of remembering long docker compose invocations.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in Docker & Kubernetes Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

AI assistant · trained on my work

👋

Hey there!

Quick Actions

WhatsApp Direct line to me

Chat on WhatsApp

+880 1723 741224 · Replies within the hour on working days

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

mejba.13@gmail.com

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support