Getting started with Docker Compose
So far in this chapter, we have studied how to write a Dockerfile, create a Docker image, and run a container of this Docker image.
Today, applications are not working in standalone mode; they need other dependencies such as a service (for example, another application; an application programming interface (API)) or a database. This implies that for these applications, the Docker workflow is more consistent. Indeed, when we work with several Docker applications, we have to execute for each of them the docker build
and docker run
commands, which requires some effort.
Docker Compose is a more advanced Docker tool that allows us to deploy several Docker containers at the same time in the same deployment cycle. Docker Compose also allows us to manage elements that are common to these Docker containers, such as data volumes and network configuration.
Note
For more details about Docker Compose, read the official documentation here: