Using Docker networks
Docker supports the concept of virtual networks. Docker Compose uses them to provide network isolation between applications. By default, every application started with Docker Compose has its own virtual network named after the application's namespace. That means, if you start two different applications with docker-compose, they will not be able to see each other.
Within an application's namespace, the network created by docker-compose provides DNS service discovery. In the case of the example multi-container application, there were DNS entries created for the web and database services called web and db, respectively. In the configuration for the web application (MyApp/config.yml.in), the database connection is configured to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access