Interview Prep/Docker/Networking, DNS and Compose

`Bind for 0.0.0.0:5432 failed: port is already allocated`

BeginnerTroubleshootingNetworking, DNS and Compose
Answer

Likely causes → Another container or host process uses that port.

Diagnose →

sudo ss -tlnp | grep 5432
docker ps --format '{{.Names}} {{.Ports}}' | grep 5432

Fix → Stop the other process, or map another host port (-p 5433:5432), or drop the publish.

Prevent → Don't publish DB ports; use internal networks.

All Docker questions Roadmap: Docker & containers

More on Networking, DNS and Compose