Compose is a tool for defining and running multi-container Docker applications.
With Docker Compose, you can link multiple containers and deploy an application from a single command. Docker Compose uses a YAML file to define a complex stack in a file. Then, with a single command, you create and start all the services from your configuration.
In this tutorial, I will show you how to install Docker Compose on CentOS 8.
Install Docker
Update your system.
# dnf update -y
Add Docker-CE repository to your system.
# dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
Install the latest version of docker.
# dnf install docker-ce --nobest
Start docker and add it to startup.
# systemctl start docker # systemctl enable docker
Verify the docker version.
# docker --version Docker version 19.03.6, build 369ce74a3c
Install Docker Compose
Docker Compose is not available in the CentOS 8 default repository. You need to download it from the Git.
Install the curl command.
# dnf install curl
Download the latest version of Docker Compose.
# curl -L https://github.com/docker/compose/releases/download/1.25.4/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
You can check the lastest releases here
Note: If the command docker-compose fails after installation, check your path. You can also create a symbolic link to /usr/bin or any other directory in your path.
# ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
Test the installation.
# docker-compose --version docker-compose version 1.25.4, build 8d51620a
Uninstallation
To uninstall Docker Compose if you installed using curl.
# rm /usr/local/bin/docker-compose # dnf remove docker-ce