Docker Compose

Docker Compose

In this tutorial we will discuss about docker compose. Docker Compose is an advanced Docker tool that simplifies your workflow.

docker compose

To be most successful with this article, you should already have some experience with Docker.

And going forward we will be working with configurations in YAML files. So it is important that you are comfortable with YAML.

If we need to setup a complex application running multiple services, a better way to do it to use docker compose.

With this tool, we could create a configuration file in YAML format called docker-compose.yml and mainly used to run multiple containers as a single service.

For example, suppose you had an application which required NGNIX, Kafka and MySQL, you could create one docker-compose.yml file which would start both the containers as a service without the need to start each one separately.

Docker compose is an excellent tool for development, testing, CI workflows, and staging environments. According to the Docker documentation, the most popular features of Docker Compose are

  • Multiple isolated environments on a single host
  • Preserve volume data when containers are created
  • Only recreate containers that have changed
  • Variables and moving a composition between environments
  • Orchestrate multiple containers that work together
Install Docker Compose

Docker Compose uses the Docker Engine, so you’ll need to have the Docker Engine installed on your device. You can refer here for docker installation.

You can install Compose on on Mac, Windows, Windows Server 2016, or Linux systems, or find out about alternatives like using the pip Python package manager or installing Compose as a container.

And in this tutorial i will explain how to install docker compose in Linux.

Firstly, you need to install the Docker Engine

Secondly, run the following command to download the current stable release of Docker Compose

$ sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Thirdly, and most importantly you need to apply executable permissions to the binary

$ sudo chmod +x /usr/local/bin/docker-compose

Finally to test the installation to check it worked properly

$ docker-compose -version
docker-compose version 1.27.4, build 40524192

For more details on installing Docker and Compose, visit the official Docker documentation page.

Docker Compose


Scroll to top