Interview Prep/Docker/Networking, DNS and Compose

`getaddrinfo ENOTFOUND db` in a Compose app.

BeginnerTroubleshootingNetworking, DNS and Compose
Answer

Likely causes → Service name typo, services on different networks, or the DB container exited.

Diagnose →

docker compose ps
docker compose exec api getent hosts db
docker network inspect <project>_default

Fix → Use the exact service name, put services on a shared network, fix the DB crash.

Prevent → Define networks explicitly and add health-gated depends_on.

All Docker questions Roadmap: Docker & containers

More on Networking, DNS and Compose