HomeARCHInstall Docker Engine on Linux Systems

Install Docker Engine on Linux Systems

This guide will take you through how to install Docker Engine on Linux systems i.e. Debian / Ubuntu / CentOS / Rocky / Arch Linux / Open SUSE. Docker is a popular open-source platform used for creating, deploying, and managing applications in containers. Containers are lightweight, portable, and self-contained environments that can run software applications and their dependencies in a standardized way, regardless of the underlying infrastructure.

Docker enables developers to package their applications into a container image that includes all the necessary libraries, dependencies, and configuration files. These container images can then be easily distributed and deployed on any platform that supports Docker, such as a local machine, cloud provider, or on-premises server.

Docker provides a range of tools and services for managing containers, including Docker Engine, Docker Compose, and Docker Swarm. Docker Engine is the core component that runs and manages containers, while Docker Compose allows users to define and run multi-container applications. Docker Swarm is a container orchestration platform that enables users to manage and scale container clusters.

Benefits of using Docker include improved application portability, easier deployment and scaling, reduced infrastructure costs, and greater efficiency and flexibility in managing and updating applications. Docker has become an essential tool for modern application development and deployment and is widely used by developers and organizations of all sizes.

In this guide, we will learn how to Install Docker Engine on Debian / Ubuntu / CentOS / Rocky / Arch Linux / Open SUSE.

Install Docker Engine on Linux Systems

Install Docker Engine on Linux Systems as shown below;

1. Install Docker Engine on Debian 12/ Debian 11 / Debian 10

Begin by updating the package repositories:

sudo apt update

Install the required packages:

sudo apt install lsb-release gnupg2 apt-transport-https ca-certificates curl software-properties-common -y

Import the GPG key for Docker:

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/debian.gpg

Now add the stable Docker repository:

sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

Update the APT package index and install all the docker packages:

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

Once installed, add your system user to the docker group:

sudo usermod -aG docker $USER
newgrp docker

2. Install Docker Engine On Ubuntu 18.04|20.04|22.04

To install the Docker engine on Ubuntu 18.04|20.04|22.04, follow the below steps.

First, update the APT package index:

sudo apt update

Remove any previous Docker packages:

sudo apt remove docker docker-engine docker.io 2>/dev/null

Install the required packages:

sudo apt -y install lsb-release gnupg apt-transport-https ca-certificates curl software-properties-common

Add the official Docker repository keys:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/docker.gpg

Add the Docker repo on Ubuntu:

sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Update your system and install Docker CE using the command:

sudo apt update && sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin

Once the installation is complete, add your system user to the Docker group:

sudo usermod -aG docker $USER
newgrp docker

Verify the installation:

$ docker version
Client: Docker Engine - Community
 Version:           23.0.2
 API version:       1.42
 Go version:        go1.19.7
 Git commit:        569dd73
 Built:             Mon Mar 27 16:16:30 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          23.0.2
  API version:      1.42 (minimum version 1.12)
  Go version:       go1.19.7
  Git commit:       219f21b
  Built:            Mon Mar 27 16:16:30 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.19
  GitCommit:        1e1ea6e986c6c86565bc33d52e34b81b3e2bc71f
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

3. Install Docker Engine on Rocky Linux|Alma Linux|CentOS

Begin by uninstalling old Docker packages:

sudo yum remove docker docker-common docker-selinux docker-engine

Install the required packages:

sudo yum -y install yum-utils device-mapper-persistent-data lvm2

Then add the stable repository:

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

Now install Docker CE on Rocky Linux|Alma Linux|CentOS

sudo yum -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin

If the installation fails, use the –allowerasing flag as shown:

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

Start and enable the Docker service:

sudo systemctl start docker && sudo systemctl enable docker

Add your system user to the Docker group:

sudo usermod -aG docker $USER
newgrp docker

4. Install Docker Engine on Fedora 38/37/36/35/34/33

Docker Engine can also be installed on Fedora Linux. To achieve this, follow the below steps:

First, remove any previous installations:

sudo dnf remove docker docker-common docker-selinux docker-engine-selinux docker-engine 2>/dev/null

Then add the Docker repo to your system:

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

Install Docker CE on Fedora:

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

Start and enable the Docker service:

sudo systemctl start docker && sudo systemctl enable docker

Finally, add your system user to the Docker Group:

sudo usermod -aG docker $USER
newgrp docker

5. Install Docker Engine On RedHat Linux

To install Docker CE on Rhel, first, add the repository with the command:

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo

Install Docker CE on RHEL with the command:

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

Start and enable the Docker service on the system:

sudo systemctl start docker
sudo systemctl enable docker

Add your system user to the Docker group:

sudo usermod -aG docker $USER
newgrp docker

6. Install Docker Engine on SLES|OpenSUSE

It is also possible to install Docker on SUSE systems. This requires you to follow the below steps:

Enable the OpenSUSE SELinux repo on your system:

sles_version="$(. /etc/os-release && echo "${VERSION_ID##*.}")"
opensuse_repo="https://download.opensuse.org/repositories/security:SELinux/SLE_15_SP$sles_version/security:SELinux.repo"
sudo zypper addrepo $opensuse_repo 

Now add the stable Docker repo:

sudo zypper addrepo https://download.docker.com/linux/sles/docker-ce.repo
 sudo zypper install docker-ce docker-ce-cli containerd.io docker-compose-plugin

Now start and enable the service:

sudo systemctl start docker
sudo systemctl enable docker

Add your system user to the Docker Group:

sudo usermod -aG docker $USER
newgrp docker

7. Install Docker Engine on Arch Linux|Manjaro|EndeavourOS

Here, you need to have yay installed on your system. To install yay, use the commands:

sudo pacman -S --needed git base-devel
git clone https://aur.archlinux.org/yay-bin.git
cd yay-bin
makepkg -si

Once installed, use it to install Docker as shown:

yay -S --noconfirm --needed docker

Finally, add your system user to the Docker group:

sudo usermod -aG docker $USER
newgrp docker

Closing Thoughts

That marks the end of this guide on how to install Docker Engine on Debian / Ubuntu / CentOS / Rocky / Arch Linux / Open SUSE. I hope this was informative. In case of any challenges, feel free to share them in the comments below.

Read more about Docker Engine.

See more:

Klinsmann Öteyo
Klinsmann Öteyo
Self proclaimed Geek
- Advertisment -

Recent posts

LEAVE A REPLY

Please enter your comment!
Please enter your name here