Articles

How to Install Docker and Compose on CentOS 8

By Rabins Sharma Lamichhane

October 01, 2022

Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. The service has both free and premium tiers. The software that hosts the containers is called Docker Engine. It was first started in 2013 and is developed by Docker

In this tutorial, we will show you how to install Docker Compose on CentOS 8.

How to Install Docker and Compose on CentOS 8

Follow the following steps to install docker and docker compose on centOS 8:

Step 1 – Update System Packages

Open a terminal and execute the following command on the terminal to update system packages:

# dnf update -y

Step 2 – Add Docker Repository

Then execute the following command on terminal to add Docker-CE repository to system:

# dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

Step 3 – Install Docker

Install the latest version of docker by executing the following command on terminal:

# dnf install docker-ce --nobest

Step 4 – Start And Enable Docker

Execute the following command on the terminal to start and enable docker:

# systemctl start docker # systemctl enable docker

Step 5 – Verify Docker Installation

Verify the docker version by executing the following command on terminal:

# docker --version Docker version 19.03.6, build 369ce74a3c

Step 6 – Install Docker Compose

Docker Compose is not available in the CentOS 8 default repository. We 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

We can check the lastest releases here.

Note: If the command docker-compose fails after installation, check your path. We can also create a symbolic link to /usr/bin or any other directory in 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

Step 7 – Uninstallation Docker Compose

To uninstall Docker Compose using curl by executing the following command on terminal:

# rm /usr/local/bin/docker-compose # dnf remove docker-ce

Conclusion

In this tutorial, we have learned how to install Docker Compose on CentOS 8.

Images mentioned above related to CentOS are either copyright property of respective image owners.

Share this: