Skip to content

Install Docker on Linux (Ubuntu, Debian and RHEL) to Manage Containers

Install Docker Engine natively on Linux, configure Docker securely and verify that your containers are working.

WRITTEN BY: ADRIEN PIRON • UPDATED ON 5 SEPTEMBER 2026 • 4 MIN READ

Docker lets you create, deploy and run applications in isolated containers, keeping development, testing and production environments consistent. This guide explains how to install Docker on the main Linux families and which post-installation settings are useful straight away.

Install Docker on Ubuntu and Debian distributions

Docker Engine runs natively on Linux, without an additional virtualization layer, which provides better container performance. On Debian- or Ubuntu-based distributions, start by removing conflicting packages that could interfere with the installation.

Debian
sudo apt remove docker.io docker-compose docker-doc podman-docker containerd runc

Once the system is clean, prepare the package manager by installing the dependencies required to add new repositories securely.

Debian
sudo apt update && sudo apt install -y ca-certificates curl gnupg

For security, add Docker’s official GPG key so the integrity of downloaded packages can be verified. For Debian, configure the keyring with these commands. Ubuntu users only need to replace debian with ubuntu in the repository address.

Debian
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

(Note: for Ubuntu, replace debian with ubuntu in the URL.)

With the key in place, register the Docker repository with APT so the system can locate the required binaries.

Debian
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

To finish, refresh the package indexes and install the components required by Docker Engine, including the build tools and Docker Compose plugin.

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

The procedures described for Ubuntu and Debian also work on WSL (Windows Subsystem for Linux).

Smart Ads

Install Docker on Rocky Linux and RHEL distributions

If you use an RHEL- or Rocky Linux-based distribution, the procedure is slightly different because it uses the DNF package manager. Start by removing any existing or conflicting container software to ensure a clean installation.

sudo dnf remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine podman runc

Once the environment is clean, install the repository-management plugin and configure Docker’s official repository to access recent engine versions.

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

Finally, install Docker Engine and its plugins, then enable and start the service so that it launches automatically with the system.

sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl start docker
sudo systemctl enable docker

Configure Docker on Linux after installation

Docker commands require superuser privileges by default. You can make everyday use easier by adding your account to the Docker group.

Debian
sudo usermod -aG docker $USER

After this change, refresh your permissions by running newgrp docker or by closing your current session and signing in again. Remember that membership of this group gives your user privileges equivalent to the system administrator. For stronger isolation, consider rootless mode.

Configure the Docker daemon for production

To stop log files from filling your storage unnecessarily, customize the Docker daemon. Create or edit /etc/docker/daemon.json with the following content to limit log size and file count.

Debian
{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  }
}

After saving the file, restart the Docker service to apply the new limits immediately.

Debian
sudo systemctl restart docker

Make sure Docker is configured correctly

After installation, verify that the environment works. Run the official test container to validate the configuration immediately.

Debian
docker run hello-world

If the terminal displays “Hello from Docker!”, your Docker engine is installed and working. If there is a connection problem, check the service status to identify the cause.

Debian
systemctl status docker

You can also use a more detailed inspection command to view the daemon status, allocated resources and storage drivers currently used by the system.

Debian
docker info
Advertising pressure
Too many readers are currently using an ad blocker

We allow some readers to view our articles for free with an ad blocker. However, their number is currently too high for us to keep this access available to everyone.

You can disable your ad blocker to continue reading immediately, subscribe to enjoy all our content without ads, or come back a little later when the pressure has eased.

I have disabled my ad blocker

Access will be restored automatically as soon as the situation allows.