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.

Run this prompt with AI

Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.

Related prompts

More Docker with AI prompts & error guides

Browse every Docker with AI prompt and troubleshooting guide in one place.

Free download · 368-page PDF

Reading prompts? Get all 500 in one free PDF

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.