How to install Docker Compose on Ubuntu 20.04?

Overview

Docker makes it easier to manage application processes in containers. While containers are similar to virtual machines in certain aspects, they are lighter and less resource-intensive. This enables developers to divide an application environment into several independent services.

For applications that rely on several services, orchestrating all of the containers to start up, communicate, and shut down at the same time can quickly become cumbersome. You can execute multi-container application setups based on YAML definitions using the Docker Compose tool. It creates fully customized environments with many containers that can share networks and data volumes via service definitions.

This tutorial will show you how to install Docker Compose on an Ubuntu 20.04 server and get started with it.

Prerequisites

There are certain prerequisites that need to be met before you begin.

  • Ubuntu 20.04 LTS configured on your system.

  • Non-root sudo user privileges.

  • Docker must be installed on your machine, follow the steps in our previous article.

Get Started

1. You should download Docker Compose from its official GitHub repository to ensure that you have the most recent stable version. Verify the most recent version on their releases website. The most recent stable version is 1.29.2 in reference to this tutorial. To make this program publicly accessible as docker-compose, run the command below to download the 1.29.2 version and save the executable file to "/usr/local/bin/docker-compose".

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

2. Next, apply the necessary permissions to ensure that the docker-compose command is executable and confirm whether the installation was successful, using the following commands.

#For setting permissions to executable
sudo chmod +x /usr/local/bin/docker-compose

#For confirming installation
docker-compose --version

Your output will turn out to be as mentioned.

Conclusion

Your machine has now been successfully configured to run Docker Compose.

Last updated