How to Install Docker Compose on CentOS 7

November 19, 2019

Introduction

Docker Compose is a tool used to define and run multi-container Docker applications. Users utilize this software to launch, execute, communicate, and close containers with a single coordinated command.

This tutorial will show you how to install Docker Compose on CentOS 7.

guide for centos install docker-compose

Prerequisites

  • A system running CentOS 7
  • A user account with sudo privileges
  • An existing Docker installation on CentOS
  • A command-line/terminal window (Ctrl-Alt-F2)

Installing Docker Compose from GitHub Repository

You can download Docker Composer from the official CentOS repository, but it is generally not advisable to do so. The best option is to install the binary package from the GitHub repository as is it ensures you are downloading the most up-to-date software.

Following these simple steps to start using Docker Compose on CentOS.

Step 1: Update Repositories and Packages

Before starting any installation, make sure to update the software repositories and software packages.

In the terminal enter the following commands:

sudo yum update
sudo yum upgrade

In the next step, you will use the curl command to download the binaries for Docker Compose. Beforehand, check whether you have the required command-tool by typing:

curl

curl is installed on the system if the output displays the message curl: try 'curl --help' or 'curl --manual' for more information.

curl missing during installation with a prompt for more information

If you see curl: command not found, you will need to install it before setting up Docker Compose.

To install curl, use the command:

sudo yum install curl

Note: For more tutorials on curl, visit our guides How To Set Or Change User Agent With Curl and How To Make Curl Ignore Certificate Errors.

Step 2: Download Docker Compose 

First, download the current stable release of Docker Compose (1.24.1.) by running the curl command:

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

The –L option tells the system to follow any redirects, in case the file has been moved. –o changes the filename to docker-compose so you can easily find it when needed. The option /usr/local/bin/ specifies the location in which to store the software package.

Note: At the time of writing, the latest stable release of Docker Container was 1.24.1. To check for new releases, refer to the Docker Compose page on GitHub. To install a specific version, substitute 1.24.1 from the URL with the preferred version number.

Next, change the file permissions to make the software executable:

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

Docker Compose does not require running an installation script. As soon as you download the software, it will be ready to use.

Step 3: Verify Installation

To verify the installation, use the following command that checks the version installed:

docker–compose –-version
output and verification of docker compose installed showing the version

Install Docker Compose using Pip

If you are having trouble installing Docker Compose with the steps mentioned above, try downloading the software using the Pip package manager.

Simply type in the following command in the terminal window:

sudo pip install docker-compose
example of code for installing docker-compose with pip

The output should show you if docker-compose-1.24.1 (the latest version at the time of writing) has been successfully installed.

docker compose version 1.24.1 installed successfully using PIP

Note: If you do not have Pip, take a look at our guide on How to Install Pip on CentOS.

How to Uninstall Docker Compose

To uninstall Docker Compose, if you installed using curl run:

sudo rm /usr/local/bin/docker-compose

If you installed the software using the pip command, remove Docker Compose with the command:

pip uninstall docker-compose

Conclusion

Now you know how to install Docker Compose on CentOS 7. The article includes two options for installation, one of which should work on your system.

After installation, you may want to look into the best practices for Docker container Management.

Was this article helpful?
YesNo
Sofija Simic
Sofija Simic is an experienced Technical Writer. Alongside her educational background in teaching and writing, she has had a lifelong passion for information technology. She is committed to unscrambling confusing IT concepts and streamlining intricate software installations.
Next you should read
How to Install Docker on CentOS 8
December 27, 2019

CentOS 8 does not provide official support for Docker. This article clearly shows you...
Read more
How to Install Docker Compose on Ubuntu 18.04
June 10, 2019

Docker Compose is a software package that modifies the behavior...
Read more
How to List / Start / Stop Docker Containers
May 27, 2019

A Docker container uses an image of a preconfigured operating system...
Read more
How to Share Data Between Docker Containers
March 26, 2019

Docker allows users to run applications isolated from a host computer, without the...
Read more