Interview Prep/Docker/Networking, DNS and Compose

`nginx: [emerg] host not found in upstream "api" in /etc/nginx/conf.d/default.conf:3`

BeginnerTroubleshootingNetworking, DNS and Compose
Answer

Likely causes → nginx started before api was resolvable (not up or different network); nginx resolves upstreams at startup.

Diagnose → docker compose ps; docker compose exec nginx getent hosts api.

Fix → Start order with depends_on, same network, or use a resolver 127.0.0.11 plus variable-based proxy_pass.

Prevent → Health-gated startup.

All Docker questions Roadmap: Docker & containers

More on Networking, DNS and Compose