Updated: 28 September 2026 · Applies to: Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9
CentOS 7 and RHEL 7 are end of life. Install Docker Engine from Docker's repository on AlmaLinux 9 / Rocky Linux 9 (or Ubuntu/Debian).
Install Docker Engine (official repository)
Ubuntu 24.04 / Debian 12:
apt install ca-certificates curl install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc chmod a+r /etc/apt/keyrings/docker.asc tee /etc/apt/sources.list.d/docker.sources <<EOF Types: deb URIs: https://download.docker.com/linux/ubuntu Suites: $(. /etc/os-release && echo "$VERSION_CODENAME") Components: stable Architectures: $(dpkg --print-architecture) Signed-By: /etc/apt/keyrings/docker.asc EOF apt update apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
On Debian, use https://download.docker.com/linux/debian in both the key URL and URIs.
AlmaLinux 9 / Rocky Linux 9:
dnf install dnf-plugins-core dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin systemctl enable --now docker
Test with docker run hello-world. Compose is available as docker compose.
Run Docker without sudo (optional)
usermod -aG docker youruser # log out and in again
Note: Members of the docker group effectively have root access. Add only trusted users. Published container ports bypass UFW rules; bind services to 127.0.0.1 unless they must be public.
Remove conflicting packages first
AlmaLinux and Rocky Linux include Podman. Docker's documentation asks you to remove it (and older Docker packages) before installing Docker Engine:
dnf remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine podman runc
Containers and images in /var/lib/docker are not removed.
Keep logs small
Create /etc/docker/daemon.json and restart Docker with systemctl restart docker:
{
"log-driver": "json-file",
"log-opts": { "max-size": "10m", "max-file": "3" }
}