ItsmeITItsmeIT
  • Linux
    • Debian
    • Ubuntu
  • PC/Windows
Reading: How to Install Docker on Linux (Ubuntu, Debian, RHEL, AlmaLinux)
Share
Notification Show More
Font ResizerAa
ItsmeITItsmeIT
Font ResizerAa
  • Categories
    • Linux
    • Debian
    • Ubuntu
    • PC/Windows
Have an existing account? Sign In
Follow US
© 2025 ItsmeIT. All rights reserved.

Home » Linux » Debian » How to Install Docker on Linux (Ubuntu, Debian, RHEL, AlmaLinux)

How to Install Docker on Linux (Ubuntu, Debian, RHEL, AlmaLinux)

avatar
By
Loibv
avatar
ByLoibv
The ItsmeIT team – delivering cutting-edge updates, tech trends, and insider knowledge from the world of technology.
Follow:
Last updated: August 26, 2025

When working with Docker on Linux, you get a lot of benefits: lightweight runtime, no need for WSL, and no virtualization layer like on Windows. Docker runs directly on the Linux kernel – exactly the way it was meant to be run.

In this guide, I’ll show you how to install Docker CE (Community Edition) on the two most common Linux families, with step-by-step explanations so you understand why each step is needed and how Docker installation actually works.

  • Ubuntu / Debian
  • AlmaLinux (CentOS replacement)

On Ubuntu / Debian

When you first set up an Ubuntu machine, Docker isn’t installed by default. You might have heard about running apt install docker.io – don’t use that just yet. It usually installs an outdated version.

We’ll use the official Docker repository to ensure you always get the latest version.

Step 1: Clean up any old installations (if any)

sudo apt remove docker docker-engine docker.io containerd runc

If you’ve previously tried installing Docker from the Ubuntu repo, this step helps remove those packages to avoid conflicts.

Step 2: Install required tools

sudo apt update
sudo apt install -y ca-certificates curl gnupg lsb-release

These packages help you add new repositories and verify GPG keys – Docker uses these to ensure you’re installing authentic packages.

Step 3: Add Docker’s GPG key

sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

🔑 The GPG key acts like a “digital signature” that lets apt trust the Docker repository.

Step 4: Add the official Docker repository

echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

This tells apt to include Docker’s official repo when searching for packages.

Step 5: Install Docker

sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io \
docker-buildx-plugin docker-compose-plugin

This installs the complete Docker suite, including Docker Compose as a plugin.

On AlmaLinux

AlmaLinux is a popular replacement for CentOS. Docker works fine on it, but the installation process is slightly different.

⚠️ AlmaLinux often comes with podman preinstalled – a containerization tool similar to Docker but not fully compatible. If you’re committed to using Docker, you should remove podman to avoid confusion, especially when the docker command accidentally runs podman instead. At the very least, double-check with which docker and ensure no alias is hijacking your command. Personally, I removed podman entirely on my AlmaLinux 10 setup before installing Docker.

Step 1: Remove podman and old Docker (if any)

sudo dnf remove -y docker* podman || true

Step 2: Add the Docker repository

sudo dnf install -y dnf-plugins-core
sudo dnf config-manager \
--add-repo https://download.docker.com/linux/centos/docker-ce.repo

Even though the repo is named “centos”, don’t worry – AlmaLinux is a spiritual successor to CentOS. Docker officially confirms compatibility.

Step 3: Install Docker

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

Step 4: Start and enable Docker

sudo systemctl enable --now docker

Docker will now auto-start on system boot. You can verify everything works by running:

docker version
docker run hello-world

If you see the line “Hello from Docker!”, then your installation was successful.

Don’t want to type sudo every time?

By default, Docker requires sudo since it interacts with the system socket. To run Docker commands without sudo, run:

sudo usermod -aG docker $USER

This adds your current user to the docker group, which has access to the Docker Engine (/var/run/docker.sock). Then, log out and log back in so your session picks up the new group permissions.

TAGGED:Docker
Share This Article
Facebook Reddit Telegram Threads
avatar
ByLoibv
Follow:
The ItsmeIT team – delivering cutting-edge updates, tech trends, and insider knowledge from the world of technology.
Leave a Comment

Leave a Reply Cancel reply

You must be logged in to post a comment.

Most Popular

Backup WordPress Data in Docker
How to Backup WordPress Data in Docker
Install WordPress Using Docker on Windows 11
How to Install WordPress Using Docker on Windows 11
Docker Data Folder Structure on Windows
Docker Data Folder Structure on Windows (Volume, Image, Container)
What Is Docker?
What Is Docker? How It Works and Why You Should Use It
Install Docker Desktop on Windows 11
How to Install Docker Desktop on Windows 11
ItsmeITItsmeIT
Follow US
© 2025 ItsmeIT. All Rights Reserved.
  • Privacy Policy
  • Terms of Service
Logo ItsmeIT logo
Welcome Back!

Sign in to your account

Continue with Google
Register   |Lost your password?