In most cases, applications do not consist of only one monolithic block, but rather of several application services that work together. When using Docker containers, each application service runs in its own container. When we want to run such a multi-service application, we can of course start all the participating containers with the well-known docker container run command. But this is inefficient at best. With the Docker Compose tool, we are given a way to define the application in a declarative way in a file that uses the YAML format.
Let's have a look at the content of a simple docker-compose.yml file:
version: "3.5"services: web: image: fundamentalsofdocker/ch08-web:1.0 ports: - 3000:3000 db: image: fundamentalsofdocker/ch08-db:1.0 ...