Two Compose projects need to talk to each other.
IntermediateScenarioNetworking and Compose
Answer
Situation read → Each project gets its own isolated network.
What I'd do → Create a shared external network and attach both:
networks:
shared:
external: true
name: platform-net
docker network create platform-net once; services join with an explicit alias.
Why → Explicit shared network avoids publishing ports just for inter-project calls.
Interview tip → Name collisions on service names can occur; use aliases.
More on Networking and Compose
Containers on the default bridge cannot resolve each other by name. Why, and what do you do?BeginnerHow do you expose a container only to the local host, not the internet?BeginnerDesign a Compose file for web + api + postgres + redis with correct startup ordering.IntermediateFrontend must reach the API but not the database. Segment the network.IntermediateA container needs to call a service running on the Docker host.BeginnerWhen would you use `--network host`?Intermediate