Docker is an open-source daemon-based container engine that allows us to create and deploy all applications inside containers. These containers are standardized environments that replicate independently from the host system. In CentOS 8 the Docker CE packages are not available. However, by adding an external repository, you can easily install Docker on the CentOS system.
In the latest release of CentOS 8, docker has been replaced with other packages such as buildah and podman. So, if you don’t wish to use podman packages then, remove them and install docker containers on your system. We will show you in this article, how to install Docker CE on CentOS 8 system through the command line.
All administrative commands must run a sudo or root user.
Open the terminal window from your desktop ‘activities’ menu and perform the following various steps to install the Docker CE on CentOS 8 system:
Step 1: Add Docker CE Repository
It is important to note that Docker CE packages are not available in the CentOS 8 repository. Therefore, use the following command to add the docker-ce repository to your CentOS system and enable it:
$ dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
Once the docker-ce repository is enabled on your system, the following result shows on the terminal:
Step 2: Install Docker CE
After successfully adding the docker CE repository, check the available docker version for installation by using the following command:
$ dnf list docker-ce
As you can see from the following screenshot, docker-ce is available for installation:
Now, install the Docker CE by running the below-mentioned command:
$ sudo dnf install docker-ce --nobest -y
If podman or other dependent packages are available in your system then, use the below-given command that will first erase those packages:
$ sudo dnf install docker-ce –allowerasing
Confirm the installation process by pressing the ‘y’ and then hit the ‘Enter’ key. After that, the gpg imports on your system again press ‘y’ to confirm the installation process as follows:
Step 3: Enable Docker CE services
Now, by using the following commands start the docker services on your system:
$ systemctl start docker $ systemctl enable docker $ systemctl status docker
Docker services are started and enabled on your system which is shown in the following screenshot:
Check the installed Docker CE version by executing the following command:
$ docker --version
The latest version 20.10.5 is installed on your system now which you can see in the following screenshot:
Step 4: Test the Docker CE installation
To check whether the Docker CE is working correctly or not on your system. Run the following hello-world Docker container command:
$ sudo docker run hello-world
The following message should display on the terminal after executing the above command:
The docker images can be listed by running the following command:
$ sudo docker images
That’s all about the Docker installation tutorial. We have installed Docker CE on the CentOS 8 system in this article. I hope the above-mentioned steps will help you in the installation Please share your queries through comments in the comments box.