Diagnose a Docker DNS Failure
Service A can’t reach Service B by name, though both are running. Determine whether it’s a network-membership problem, a service-name mismatch, or the default-bridge DNS limitation — and fix it.
Learning objectives
- Reproduce the resolution failure
- Inspect network membership
- Test DNS from inside the container
- Correct the network/name configuration
Before you start
Required software: Docker Engine 24+
Prerequisites: Docker Networking path (or Fundamentals)
- Download and unzip the lab.
- Start it:
docker compose up -d. - Exec into service-a and try to reach service-b by name — it fails.
Instructions
Full instructions are part of Individual Pro
Unlock the step-by-step instructions, the solution guide, validation scripts, and downloadable files.
Hints
💡 Names don’t resolve on the default bridge
The legacy default bridge network does NOT provide automatic DNS between containers — only user-defined networks do. Check which network the containers are on.
💡 Test from inside
Use docker exec service-a getent hosts service-b (or nslookup) to see whether the name resolves at all, then check docker network inspect for membership.
Validate your work
From the lab folder, run:
bash validation/validate.sh The script reads only your local Docker state, never transmits data off your machine, and returns a status code:
0— Lab successfully completed1— Validation failed2— Required dependency missing3— Lab environment not running4— Configuration error5— Validation timed out
Note: validation targets Linux first. On Docker Desktop (macOS/Windows) some host-level checks (e.g. disk usage) may report differently; each script documents its limitations.
Solution
The full solution + troubleshooting explanation is available to Individual Pro members. Try to solve it first — that’s where the learning is.
Reset the lab
docker compose down -v && docker compose up -dfrom the original lab files restores the starting (broken) state.
Interview questions
- Why do containers on a user-defined bridge resolve names but those on the default bridge don’t?
- How do you list which networks a container is attached to?
- How would you test DNS resolution from inside a container?
Finished this lab?
Sign in to record your completion and track progress across the path. Completion is recorded server-side.