Home DockerInstall Docker Engine And Docker Compose In AlmaLinux, CentOS, Rocky Linux

Install Docker Engine And Docker Compose In AlmaLinux, CentOS, Rocky Linux

A Step By Step Guide To Install Docker Engine With Docker Compose In AlmaLinux, CentOS, Rocky Linux

By sk
Published: Updated: 23K views 9 mins read

This detailed explains how to install Docker Engine with Docker Compose in RHEL-based systems such as AlmaLinux, CentOS, and Rocky Linux.

This guide has been officially tested on CentOS 9, 8, AlmaLinux 9, 8 and Rocky Linux 9, 8. For demonstration purpose, I will be using AlmaLinux 9 version. All commands given below are same for most RHEL-based systems.

1. Docker Requirements

To install and configure Docker, your system must meet the following minimum requirements.

  1. 64 bit Linux or Windows operating systems.
  2. If you're on Linux, the Kernel version should be 3.10 or above.
  3. An user account with sudo privileges.
  4. VT (virtualization technology) support enabled on your system BIOS. [Read: How To Find If A CPU Supports Virtualization Technology (VT)]
  5. Your system should be connected to Internet.

In Linux, to verify the Kernel and architecture details, run the following command from the Terminal:

uname -a

Sample Output:

Linux Almalinux 6.14.8-2-bpo12-pve #1 SMP PREEMPT_DYNAMIC PMX 6.14.8-2~bpo12+1 (2025-07-22T13:15Z) x86_64 x86_64 x86_64 GNU/Linux

As you see in the above output, my AlmaLinux system's kernel version is 6.14.8-2 and my system's architecture is 64 bit (x86_64 x86_64 x86_64 GNU/Linux).

Heads Up: Here, I am using AlmaLinux 9 container in Proxmox. This is why you see the word "pve" in the kernel version in the above output. If you're using AlmaLinux physical (or virtual) machine, you will see 6.14.8-2-generic as kernel version.

Well, the Kernel version is higher than the minimum requirement, and the arch is 64 bit. So, we can install and use Docker without any problems.

2. Install Docker in CentOS, AlmaLinux, Rocky Linux

Make sure you are running an updated OS.

2.1. Update Your System

Run the following commands one by one as sudo user or root user to update your CentOS/AlmaLinux/Rocky Linux system.

sudo dnf --refresh update
sudo dnf upgrade

2.2. Add Official Docker Repository

Install dnf-plugins-core package:

sudo dnf install -y dnf-plugins-core

Next, add the Docker repository on your system:

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

On older versions, you need to install the yum-utils package, which provides the yum-config-manager utility to setup repositories.

sudo dnf install yum-utils

Next, add Docker repository using yum-config-manger as shown below:

sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

2.3. Install Docker

Install Docker Engine on CentOS, AlmaLinux and Rocky Linux using command:

sudo dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin

After Docker packages are downloaded, you will be prompted to import the Docker GPG key. Make sure that the fingerprint matches 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35, and if so, accept it.

Importing GPG key 0x621E9F35:
Userid : "Docker Release (CE rpm) <docker@docker.com>"
Fingerprint: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
From : https://download.docker.com/linux/centos/gpg
Is this ok [y/N]: y
Install Docker In CentOS, AlmaLinux, and Rocky Linux
Install Docker In CentOS, AlmaLinux, and Rocky Linux

Once Docker installation is completed, run the following commands to enable and start Docker service.

sudo systemctl enable docker
sudo systemctl start docker

Check whether Docker service is running or not with command:

sudo systemctl status docker

Sample Output:

● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; preset: disabled)
Active: active (running) since Wed 2025-09-10 08:35:47 UTC; 17s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 814 (dockerd)
Tasks: 9
Memory: 22.1M
CPU: 145ms
CGroup: /system.slice/docker.service
└─814 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Sep 10 08:35:47 Almalinux dockerd[814]: time="2025-09-10T08:35:47.585018918Z" level=info msg="CDI directory does not exist, skipping: failed to monitor for changes: no such file or directory" dir=/var/run/cdi
Sep 10 08:35:47 Almalinux dockerd[814]: time="2025-09-10T08:35:47.592234786Z" level=info msg="Creating a containerd client" address=/run/containerd/containerd.sock timeout=1m0s
Sep 10 08:35:47 Almalinux dockerd[814]: time="2025-09-10T08:35:47.635253593Z" level=info msg="Loading containers: start."
Sep 10 08:35:47 Almalinux dockerd[814]: time="2025-09-10T08:35:47.800455591Z" level=info msg="Loading containers: done."
Sep 10 08:35:47 Almalinux dockerd[814]: time="2025-09-10T08:35:47.818175088Z" level=info msg="Docker daemon" commit=249d679 containerd-snapshotter=false storage-driver=overlay2 version=28.4.0
Sep 10 08:35:47 Almalinux dockerd[814]: time="2025-09-10T08:35:47.818235300Z" level=info msg="Initializing buildkit"
Sep 10 08:35:47 Almalinux dockerd[814]: time="2025-09-10T08:35:47.854281871Z" level=info msg="Completed buildkit initialization"
Sep 10 08:35:47 Almalinux dockerd[814]: time="2025-09-10T08:35:47.859041908Z" level=info msg="Daemon has completed initialization"
Sep 10 08:35:47 Almalinux dockerd[814]: time="2025-09-10T08:35:47.859175488Z" level=info msg="API listen on /run/docker.sock"
Sep 10 08:35:47 Almalinux systemd[1]: Started Docker Application Container Engine.

As you see in the above output, Docker service is up and running!

2.4. Check Docker Version

The installed Docker version can be found using command:

sudo docker version

Sample Output:

Client: Docker Engine - Community
Version: 28.4.0
API version: 1.51
Go version: go1.24.7
Git commit: d8eb465
Built: Wed Sep 3 21:00:35 2025
OS/Arch: linux/amd64
Context: default

Server: Docker Engine - Community
Engine:
Version: 28.4.0
API version: 1.51 (minimum version 1.24)
Go version: go1.24.7
Git commit: 249d679
Built: Wed Sep 3 20:57:19 2025
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.27
GitCommit: 05044ec0a9a75232cad458027ca83437aae3f4da
runc:
Version: 1.2.5
GitCommit: v1.2.5-0-g59923ef
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Check Docker Version In AlmaLinux
Check Docker Version In AlmaLinux

2.5. Testing Docker

Let us go ahead, and test whether Docker is working or not. We can run a hello-world docker image to verify if Docker is properly installed and working.

To do so, run:

sudo docker run hello-world

The above command will download a test Docker image, and execute a sample hello_world program inside the container.

If you see an output something like below, congratulations! Docker is working fine in your CentOS/AlmaLinux/Rocky Linux system.

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
17eec7bbc9d7: Pull complete
Digest: sha256:a0dfb02aac212703bfcb339d77d47ec32c8706ff250850ecc0e19c8737b18567
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.


To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/
Run Hello World Docker Container In AlmaLinux
Run Hello World Docker Container In AlmaLinux

Docker is ready to use!

I installed Docker, now what? Check the next article in this series to learn the Docker basics.

2.6. Upgrade Docker

Since we've installed Docker using the repository, we can upgrade Docker engine to latest available version by simply running the following commands:

sudo dnf --refresh update
sudo dnf upgrade

3. Install Docker Compose

Docker Compose is a tool that can be used to define and run multi-container Docker applications. With Compose, you use a Compose file to configure your application’s services. Then, using a single command, you can create and start all the services from your configuration.

Docker now includes Compose as a plugin:

docker compose version

If you want to install latest Docker Compose version. use any one of the following methods.

3.1. Method 1: Install Docker Compose Using Binary

Download the latest Docker Compose from here.

As of writing this, the latest version was 2.39.3.

Run the following command to download latest stable Docker compose file:

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

If a new version is available, just replace the number v2.39.3 in the above command with the new version number. Please don't forget to preface "v" before the version number.

Alternatively, you can use this command to automatically fetch the latest available version:

sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep tag_name | cut -d '"' -f4)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Finally, apply executable permissions to the binary using command:

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

To check installed docker composer version, run:

docker-compose version

Sample Output:

Docker Compose version v2.39.3

3.2. Method 2: Install Docker Compose Using PiP

Alternatively, we can install Docker Compose using PIP. Pip is a python package manager used to install applications written in Python programming language.

Refer the following guide to install Pip on your system.

Once pip installed, run the following command to install docker compose. The following command is same for all Linux distributions!

pip install docker-compose

After installing Docker Compose, you can check the version with command:

docker-compose --version

You will see an output something like below.

docker-compose version 2.39.3, build 8a1c60f6

Congratulations! We have successfully installed Docker Community Edition and Docker Compose.

Read our introductory guide to Docker Compose to learn how to use Docker compose in real time to define and manage containers.

3.3. Upgrade Docker Compose

To upgrade Docker Compose, simply download the newer package file and repeat the installation instructions as shown in Method 1.

If you have installed Compose using Pip, you can upgrade Docker Compose using the following command:

pip install --upgrade docker-compose

Related Read:


4. Uninstall Docker Engine

To remove Docker Engine from your CentOS, AlmaLinux and Rock Linux system, run:

sudo dnf remove docker-ce docker-ce-cli containerd.io docker-compose-plugin

The Docker images, containers, volumes, or customized configuration files on your system are not automatically removed.

You should manually delete all images, containers, and volumes using the following commands:

sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd

5. Uninstall Docker Compose

If you have installed Compose using binary file, simply remove it from /usr/local/bin/ path.

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

If you installed Compose using PiP, run the following command to remove Docker Compose:

pip uninstall docker-compose

6. Conclusion

We know how to install Docker Engine and Docker Compose in CentOS, AlmaLinux and Rocky Linux. We also learned how to test Docker engine by running a basic hello-world docker image. Finally, we saw how to remove Docker engine and docker compose when they are no longer required.

Resource:

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More