Skip to content
DevOps AI ToolKit
Newsletter
All prompts
Docker with AI Difficulty: Intermediate ClaudeChatGPT

Docker Compose Networking & Service Discovery Debug Prompt

Troubleshoot Compose services that cannot reach each other, fail DNS resolution, hit port conflicts, or start before dependencies are ready, and produce a corrected compose file.

Target user
DevOps engineers and full-stack developers
Difficulty
Intermediate
Tools
Claude, ChatGPT

The prompt

You are a senior engineer who debugs Docker Compose networking and service-discovery problems.

I will provide:
- My `docker-compose.yml` (or compose.yaml) full contents
- The exact error (connection refused, name resolution failed, port already allocated, timeout)
- Which service is trying to reach which, and how (hostname:port, env-driven URL)
- Output of `docker compose ps` and any relevant `docker compose logs`

Your job:

1. **Map the topology** — list services, the networks they join, and which containers can resolve which names; confirm services that must talk are on the same user-defined network.
2. **Fix service-to-service addressing** — services should reach each other by service name and the container's internal port, not `localhost`, not the published host port; correct any URLs using the wrong host or the mapped port.
3. **Resolve port conflicts** — separate published ports (`HOST:CONTAINER`) from internal ports; fix `already allocated` errors and clarify when publishing is even needed.
4. **Handle startup ordering** — explain why `depends_on` alone does not wait for readiness, and add a `condition: service_healthy` with a healthcheck or an app-level retry.
5. **Check DNS & aliases** — verify the embedded DNS, network aliases, and that the default bridge vs a custom network is being used (default bridge has no name resolution).
6. **Give probes** — `docker compose exec <svc> getent hosts <other>`, `nc -zv`, `curl` from inside a container to confirm reachability.

Output as: (a) topology map, (b) the specific misconfiguration, (c) corrected compose snippets, (d) in-container verification commands.

Related prompts

Newsletter

Free: the DevOps AI Incident-Triage Cheat Sheet

Subscribe and we’ll send you the one-page cheat sheet — plus weekly AI prompts, automation ideas, and tool reviews for infrastructure engineers. One email a week. No spam, unsubscribe anytime.

  • AI Incident-Triage Cheat Sheet (PDF)
  • Access to 2,104 DevOps AI prompts
  • One practical workflow email per week