How do containers in Compose reach each other?
BeginnerConceptDocker Compose
Answer
Compose creates a project network (<project>_default) and every service joins it; services resolve each other by service name (and aliases). Use the container port, not the published host port: db:5432, not localhost:5433.
More on Docker Compose
What is Docker Compose and what problem does it solve?Beginner`docker-compose` vs `docker compose`?BeginnerShow a minimal Compose file with a web app and a database.BeginnerWhat does `depends_on` guarantee?IntermediateHow does Compose choose the project name and why does it matter?IntermediateWhat is the difference between `ports` and `expose` in Compose?Beginner