Having issues while trying to install docker compose on a CentOS 7 server?
It can be due to missing software packages or application dependency errors.
As a part of our Server Management Services, we help our customers to install Docker compose and fix installation errors.
Today we will see the common errors we have seen while installing Docker Compose and how to fix them.
How to install docker compose in CentOs 7?
Let’s discuss how we install docker compose in CentOS 7.
1. Before starting any installation, we update the software repositories and software packages using the following commands:
yum update yum upgrade
2. Then, we download the current stable release of Docker Compose.
curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
To install a different version of Compose, we can substitute 1.26.0 with the version of Compose you wish to install.
2. After, we change the file permissions to make the software executable:
chmod +x /usr/local/bin/docker-compose
3. Finally, we can check the version installed.
The output looks like,
Common errors while installing docker compose in CentOS 7
Let’s see how our Support Engineers fix the Docker compose installation errors.
1. Lack of curl package
Some times customers get an error while installing docker compose in CentOS 7 using the command.
A common error is,
curl: command not found.
Then we install the curl by using the following command.
yum install curl
After the installation, the following will be the output when running curl command in the terminal.
When we have trouble when installing Docker Compose with the curl command, we use other alternative options.
Similarly, some of our customers experience errors while installing docker compose on their Linux system. For instance, they get below error after running installation commands:
apt-get -f install docker-compose Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt-get -f install' to correct these: The following packages have unmet dependencies: code : Depends: libnotify4 but it is not going to be installed Depends: libnss3 but it is not going to be installed Depends: libxkbfile1 but it is not going to be installed Depends: libgconf-2-4 but it is not going to be installed Depends: libsecret-1-0 but it is not going to be installed docker-compose : Depends: python-cached-property but it is not going to be installed
An alternative to apt-get is the Python Package Installer or “pip”. So, first “pip” needs to be installed.
apt-get install python-pip
Then, we use pip command to install docker-compose.
pip install docker-compose
This resolves the error.
2. Outdated version
Another common error while running ‘pip install docker-compose==1.25’ in a docker container looks like,
pip install docker-compose==1.25 fails due to lack of python headers for building subprocess32
The pip tries to compile subprocess32 and needs python headers.
Often, it is due to an outdated pip version. Because it requires pip version 6.0 or greater to install docker compose. So, we use the following command to upgrade the pip version and to install other dependencies.
yum install -y python-pip python-devel gcc
pip install --upgrade pip
pip install docker-compose
This is how we solve the issue for our customers.
[Need assistance to fix Docker compose installation errors? – Our Support Engineers will help you.]
In short, Docker Compose requires some packages such as pip and curl to be installed in CentOS 7. Today, we saw how our Support Engineers fixed the Docker compose installation errors.