Docker Compose
In this lesson, we'll discuss Docker Compose.
Overview #
A typical microservice system contains more than a single Docker container. As explained in chapter 2, microservices are modules of a system.
It would be good to have a way to start and run several containers together for starting all the modules that the system consists of in one go. This can be done with Docker Compose.
Service discovery with Docker Compose links #
Coordinating a system of multiple Docker containers requires more than just starting multiple Docker containers. It also requires configurations for the virtual network with which the Docker containers communicate with each other. In particular, containers must be able to find each other in order to communicate.
In a Docker
Compose environment, a service can simply contact another service via
a Docker Compose link and then use the service name as the hostname.
So it could use a URL like http://order/
to contact the order
microservice.
Docker Compose links offer some kind of service ...