How to Install Docker CE on Ubuntu / Debian / Fedora / Arch Linux and CentOS Linux systems ?. As of this article writing there are two main editions of Docker – Docker CE ( Community Edition) and Docker EE ( Enterprise edition). This article will be focused in the installation of Docker CE on various distributions of Linux operating system.
Docker is a container runtime engine which allows you to package an application with all of its dependencies into a standardized unit for software development.
Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in.
Here we’ll cover installation of Docker CE on Ubuntu, Debian, Fedora, and CentOS and Arch Linux distributions.
1) Install Docker CE on Ubuntu Linux
Uninstall Old version of Docker. Old versions of docker had the name docker or docker-engine. If you have it installed, first uninstall it.
sudo apt update
sudo apt remove docker docker-engine docker.io 2>/dev/null
The Docker CE package is now called docker-ce. Update the apt
package index:
sudo apt update
Install packages to allow apt to use a repository over HTTPS:
sudo apt -y install lsb-release gnupg apt-transport-https ca-certificates curl software-properties-common
Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/docker.gpg
Add stable repository:
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Install docker ce:
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
If you would like to use Docker as a non-root user, you should now consider adding your user to the “docker” group with something like:
sudo usermod -aG docker $USER
newgrp docker
Run the command below to see a version of docker installed.
$ docker version
Client: Docker Engine - Community
Version: 24.0.5
API version: 1.43
Go version: go1.20.6
Git commit: ced0996
Built: Fri Jul 21 20:35:18 2023
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 24.0.5
API version: 1.43 (minimum version 1.12)
Go version: go1.20.6
Git commit: a61e2b4
Built: Fri Jul 21 20:35:18 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.22
GitCommit: 8165feabfdfe38c65b599c4993d227328c231fca
runc:
Version: 1.1.8
GitCommit: v1.1.8-0-g82f18fe
docker-init:
Version: 0.19.0
GitCommit: de40ad0
To get more details about docker, run:
docker info
Check Docker Compose version using the commands:
$ docker compose version
Docker Compose version v2.20.2
2) Install Docker CE on Debian Linux system
Update the apt package index:
sudo apt update
Install packages to allow apt to use a repository over HTTPS:
sudo apt install lsb-release gnupg2 apt-transport-https ca-certificates curl software-properties-common -y
Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/debian.gpg
Set up the stable repository:
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
Install Docker Engine and its dependencies:
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Add your user account to the docker group:
sudo usermod -aG docker $USER
newgrp docker
3) Install Docker CE on Fedora Linux
Uninstall Older versions of Docker:
sudo dnf remove docker docker-common docker-selinux docker-engine-selinux docker-engine 2>/dev/null
Configure Docker repository:
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:
sudo dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Start and enable docker service:
sudo systemctl start docker && sudo systemctl enable docker
Add your user account to the docker group:
sudo usermod -aG docker $USER
newgrp docker
4) Install Docker CE on CentOS / Rocky Linux / AlmaLinux
Uninstall old versions:
sudo yum remove docker docker-common docker-selinux docker-engine
Install required dependencies:
sudo yum -y install yum-utils device-mapper-persistent-data lvm2
Setup stable repo:
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Install Docker CE:
sudo yum -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Start and enable docker service:
sudo systemctl start docker && sudo systemctl enable docker
Add your user account to the docker group:
sudo usermod -aG docker $USER
newgrp docker
Check service status:
systemctl status docker
5) Install Docker CE on SLES / OpenSUSE
The OpenSUSE SELinux repository must be enabled.
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
Set up the Docker repository
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
Start and enable Docker service
sudo systemctl start docker
sudo systemctl enable docker
Add your user account to the docker group:
sudo usermod -aG docker $USER
newgrp docker
6) Install Docker CE on RHEL
Add Docker repository
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 system:
sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Start and enable docker service
sudo systemctl start docker
sudo systemctl enable docker
Add your user account to the docker group:
sudo usermod -aG docker $USER
newgrp docker
7) Install Docker CE on Arch | Manjaro
Install yay:
Install Docker CE using yay:
$ yay -S --noconfirm --needed docker
Add your user account to the docker group:
sudo usermod -aG docker $USER
newgrp docker
After installing Docker, you may be interested in:
- Install Docker UI manager – Portainer
- Ctop – Top command for container metrics
- Install and Configure Docker Registry on CentOS 7
- Install Docker and Docker Compose on RHEL 8 / CentOS 8
Tags
- How To Install Docker CE on Ubuntu
- How To Install Docker CE on Debian
- Install Docker CE on Arch Linux
- Install Docker CE on Fedora Linux
- Install Docker CE on CentOS Linux