The app in a container can't reach the database container: "could not translate host name db".
IntermediateHands-onLive debugging tasks
Answer
docker network ls
docker inspect api --format '{{json .NetworkSettings.Networks}}' | jq 'keys'
docker inspect db --format '{{json .NetworkSettings.Networks}}' | jq 'keys'
docker network create appnet
docker network connect appnet api
docker network connect appnet db
docker exec api getent hosts db
Key trick → Container name DNS only works on user-defined networks, not the default bridge. Both containers must share a network (Compose creates one automatically).
More on Live debugging tasks
A pod is in CrashLoopBackOff. You have 10 minutes. Walk through your commands.BeginnerThe pod shows `OOMKilled`. Diagnose and fix it.BeginnerA pod is stuck in `ImagePullBackOff`. Fix it.BeginnerA pod is `Pending` forever. What do you check?AdvancedThe Service returns "connection refused" but pods are Running. Debug it.IntermediateA Docker container exits immediately after `docker run -d`. Find out why.Beginner