Introduction to Docker Compose

Docker Compose is a tool that simplifies the deployment of multicontainer applications. It relies on YAML configuration files to configure each container. Each container definition in the YAML file describes all parameters that can be provided as arguments to the Docker command. It also contains some additional parameters for additional features provided by Docker Compose. The following are the features of Docker Compose:

  • Run multicontainer applications on a single host: Multiple containers can be defined in the configuration file. All these containers are started and stopped with a single command.
  • Save and restore volume bindings when containers are created: If a container is updated, then its volume bindings are restored from the last version of the container. This allows us to keep data when upgrading containers.
  • Create containers only when their configuration has changed: When a full stack is stopped and restarted, only the containers that changed are recreated. This allows us to restart a stack faster.
  • Environment variable substitution: Some variables can be used in the configuration file so that different configurations can be used. These variables are defined in another dedicated configuration file.

With Docker Compose, deploying an application is much simpler than starting all services manually, and it is also easier to scale the services. The full stack of the audio transcoder application requires three containers: one for the reverse proxy, one for Minio, and one for the transcoder. The following figure shows this architecture:

Figure 11.7: The audio transcoder application stack

Let's see how to create this setup.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.178.53