Docker is a popular platform for building, shipping, and running applications in containers. Docker Compose is a tool for defining and running multi-container Docker applications. In this guide, we will walk you through the steps to install Docker and Docker Compose on AlmaLinux.
Prerequisites
Before you begin, make sure you have the following:
- A system running AlmaLinux.
- A user account with sudo privileges.
Step 1: Update the System (The Hard Way)
First, update the package index and upgrade the installed packages to their latest versions:
sudo dnf update
Step 2: Install Docker
To install Docker, you need to add the Docker repository to your system. Run the following commands to add the repository and install Docker:
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Step 3: Start and Enable Docker
After installing Docker, start the Docker service and enable it to start at boot:
sudo systemctl start docker
sudo systemctl enable docker
Step 4: Verify Docker Installation
To verify that Docker is installed correctly, run the following command:
#For Docker version
docker --version
#For Docker compose version
docker compose versionYou should see output similar to the following:
Client: Docker Engine - Community
Version: 29.2.1
API version: 1.53
Go version: go1.25.6
Git commit: a5c7197
Built: Mon Feb 2 17:18:50 2026
OS/Arch: linux/arm64
Context: default
Server: Docker Engine - Community
Engine:
Version: 29.2.1
API version: 1.53 (minimum version 1.44)
Go version: go1.25.6
Git commit: 6bc6209
Built: Mon Feb 2 17:16:57 2026
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: v2.2.1
GitCommit: dea7da592f5d1d2b7755e3a161be07f43fad8f75
runc:
Version: 1.3.4
GitCommit: v1.3.4-0-gd6d73eb8
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Docker Compose version v5.0.2Step 5 (Recommended): Run Docker without sudo
sudo usermod -aG docker $USERAutomate the Installation with a Bash Script (Easy Way)
To automate the installation process, you can use the following bash script:
#!/bin/bash
set -euo pipefail
# --------------------------------------------------
# Update system
# --------------------------------------------------
sudo dnf -y update
# --------------------------------------------------
# Install prerequisites
# --------------------------------------------------
sudo dnf -y install dnf-plugins-core
# --------------------------------------------------
# Add official Docker repository (CentOS/RHEL compatible)
# --------------------------------------------------
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# --------------------------------------------------
# Install Docker Engine + official plugins
# --------------------------------------------------
sudo dnf -y install \
docker-ce \
docker-ce-cli \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin
# --------------------------------------------------
# Enable and start Docker
# --------------------------------------------------
sudo systemctl enable --now docker
# --------------------------------------------------
# (Optional) Allow non-root Docker usage
# Uncomment if required
# --------------------------------------------------
# sudo usermod -aG docker "$USER"
# newgrp docker
To use this script, simply copy the code above into a file, for example, install_docker.sh, and make it executable:
chmod +x install_docker.sh
Then, run the script with sudo:
sudo ./install_docker.sh
This script will update your system, install Docker and Docker Compose, and verify the installations.
Conclusion
In this guide, we have shown you how to install Docker and Docker Compose on AlmaLinux. You can now use Docker and Docker Compose to build, ship, and run applications in containers. If you have any questions or run into any issues, feel free to ask for help in the comments below.