We will learn How to install docker on centos 8 in this article. Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels.
CentOS 8 uses the YUM package manager version v4.0.4. This version now uses DNF (Dandified YUM). DNF is a software package manager. It installs, performs updates, and removes packages on Linux distributions.
Use the following command to add and enable the official Docker CE repository:
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
Now check the downloaded Repo of Docker using the following command:
dnf repolist -v
To list all the available docker-ce packages, use the following command:
dnf list docker-ce --showduplicates | sort -r
Install Docker CE on CentOS 8:
First, we will install the containerd.io package manually. This workaround allows you to install the latest docker-ce version.
dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.10-3.2.el7.x86_64.rpm
Now we can proceed to install the latest version of docker-ce with the following command:
dnf install docker-ce -y
Now Enable Docker using the following command:
systemctl enable --now docker
systemctl status docker
Disable firewall to aviod any communication issue while running services in Docker container.
systemctl disable firewalld
systemctl stop firewalld
Download a small alpine docker container image to test the installation using the following command:
docker pull alpine
Check if the image is available using the following command:
docker images
We have successfully installed Docker on CentOS 8. You can now use Docker according to your need.