Installation Docker on CentOS 8 Linux / Stream or RHEL 8 is simple and same as before we were doing on CentOS 7.5. Docker is available in two editions community and enterprises. Here we let you know to install Docker community edition which includes Docker Engine, Docker Command line and Docker Compose.
Install Docker Ce Centos 8 Download
So, let’s get started with the tutorial:
Step 1: Open Command Terminal and login as root.
For that simply type:
- Install Docker CE from the docker-ce repository. Sudo yum install docker-ce docker-ce-cli containerd.io. Enable and start the docker systemd service. Sudo systemctl enable docker. Sudo systemctl start docker. Sudo systemctl disable firewalld. If you don’t disable firewalld, your containers will fail to resolve any domain name through DNS.
- May 25, 2020 Docker is an open-source containerization platform that allows you to quickly build, test, and deploy applications as portable containers that can run anywhere. This tutorial covers how to install the latest version of Docker on an CentOS 8 machine from the official Docker’s repositories.
If you want to use docker-compose on CentOS 8 in combination with firewalld you'll run into troubles because there has been a switch to nftables. With no further steps you wouldn't be able to reach your docker container from a client. Installing Docker on CentOS 8. To get Docker on your system, ensure that you have the following before proceeding: An instance of CentOS 8 ready. SSH access to the server with a sudo user configured. Stable and reliable internet connectivity. Once all is clear, follow the steps outlined to install Docker on CentOS. Step 1: Update the System.
And when it asks for the root password given that.
Step 2: Install some required packages for the Docker installation
Device-mapper-persistent-data and lvm2 are required by the device-mapper storage driver, while yum-utils provides yum-config-manager to set repository using a single command.
Step 3: Add Docker repository to CentSO 8 or RHEL 8
To download and install the Docker’s latest version of the CentOS 8 or Stream, we will use the Yum config manager to configure the Docker repo, so that our system can recognize the location from where to fetch the RMP packages.
or
Step 4: Run System update command
After enabling the Docker repo, run the system update command to flush the cache. For that type:
or
Step 5: Command to instal Docker community edition on CentOS 8
Finally, everything has been set up and its time to install Docker engine on our server with CLI and Compose components.
or
In the case above command give an error:
So, we are getting an error because the dnf trying to find the latest upgrade packages even if the dependencies do not support it. Thus we use –nobest flag to cure this problem.
Thus the command will be
Step 6: Enable Docker System Service (daemon)
Here is the command to make the Docker service as a system so that it can start automatically with system boot up.
Step 7: Start Docker service
Now, finally, we start the docker service to start working around with it.
Step 8: Verify that Docker Engine working perfectly
Let’s fetch the hello-world image to test the Docker working. However, we directly command the Docker to run hello-world image which it will not find on our local system and pull automatically from the Docker hub.
Step 9: Pull some Linux distro image

Just to give you an idea, how we can run different Linux operating system on CentOS 8 installed Docker. Hence, here we will pull the latest Ubuntu image. For that, the command is
By default it uses the latest tag, means it fetches the latest stable version of the Ubuntu.
After downloading it run to use the Ubuntu on CentOS 8 virtually using Docker
For more images, you can visit Docker Hub
Now install the newer docker-ce version from the Docker repository and containerd manually, because due to some issues, Red Hat blocked the installation of containerd.io 1.2.0-3.el7, which is a dependency of docker-ce.
Installing Docker on Ubuntu is simple because Ubuntu provides Docker in its repositories. However, Docker is not available in CentOS's default repositories.
Fret not, there are three ways you can install docker on a CentOS Linux system.
- Using docker's repository
- Downloading the RPM
- Using helper scripts
Here, I'll walk you through the installation process of Docker CE using docker's RPM repository.
- Install Docker CE on CentOS 8 RHEL 8. So far we have covered docker introduction and terminologies. We should be ready to install Docker CE on RHEL 8 / CentOS 8. We will start with the installation of Docker then Docker Compose. There are two editions of Docker available.
- The steps shared here are for the installation of Docker CE on RHEL 7 Linux. Docker is the main dominant container runtime engine used for Development and running of micro-serviced applications in production.
- Docker containers are lightweight, especially compared to virtual machines. This feature is especially valuable if you are a Raspberry Pi user. If you need help installing Docker on your Raspberry Pi, read our step-by-step guide on how to install Docker on Raspberry Pi.
Docker CE stands for Docker Community Edition. This is the free and open source version of Docker. There is Docker EE (Enterprise Edition) with paid support. Most of the world uses Docker CE and it is often considered synonymous to Docker.
Installing Docker on CentOS
Before going any further, make sure you have the system updated. You can update the CentOS using:
Step 1: Add the official repository
Add docker's official repository using the following command
You should also update the package cache after adding a new repository:
Step 2: Install Docker CE
The trouble with using a custom repository is that it may have dependency issue if you try installing the latest version of docker-ce.
For example, when I check the available versions of docker-ce with this command:
Install Docker Ce On Centos 8
I got docker-ce-3:19.03.9-3.el7 as the latest version. But the problem in installing the latest version is that it depends on containerd.io version >=1.2.2-3. Now, this version of containerd.io is not available in CentOS 8.
To avoid this dependency cycle and battling them manually, you can use the --nobest
option of the dnf command.
It will check the latest version of docker-ce but when it finds the dependency issue, it checks the next available version of docker-ce. Basically, it helps you automatically install the most suitable package version with all the dependencies satisfied.
To install docker in CentOS without getting a migraine, try this command and see the magic unfold on your terminal screen:
You'll be prompted to import a GPG key, make sure the key matches to 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
before entering 'y'.
containerd.io is a daemon for managing containers. Docker is just one form of Linux containers. To make the various types of container images portable, Open Container Initiative has defined some standards. containerd is used for managing the container images conforming to OCI standard.
Setting up docker on CentOS
Alright! You have docker installed but it's not yet ready to be used yet. You'll have to do some basic configurations before it can be used smoothly.
Dnf Install Docker-ce Centos8
Run docker without sudo
You can run docker without any sudo privileges by adding your user to the docker
group.
The docker group should already exist. Check that using the following command:

If this outputs nothing, create the docker group using groupadd command like this:
Now add your user to the docker
group using the usermod command:
Change the user_name in the above command with the intended user name.
Now log out and log back in for the group change to take effect.
Start docker daemon
Docker is installed. Your user has been added to the docker
group. But that's not enough to run docker yet.
Before you can run any container, the docker daemon needs to be running. The docker daemon is the program that manages all the containers, volumes, networks etc. In other words, the daemon does all the heavy lifting.

Start the docker daemon using:
You can also enable docker daemon to start automatically at boot time:
Verify docker installation by running a sample container
Everything is done. It's time to test whether the installation was successful or not by running a docker container.
To verify, you can run the cliché hello-world docker container. It is a tiny docker image and perfect for quickly testing a docker installation.
If everything is fine, you should see an output like this:
Here's what the command is doing behind the hood:
- The docker client, i.e. the command line tool that you just used, contacted the docker daemon.
- The daemon looked for hello-world docker image in the local system. Since it doesn't find the image, it pulls it from Docker Hub.
- The engine creates the container with all the options you provided through the client's command line options.

This hello-world image is used just for testing a docker installation. If you want a more useful container, you can try running Nginx server in a container like this:
Once the command is done running, open up a browser and go to http://your_ip_address:56788. I hope you know how to know your IP address in Linux.
You should see nginx server running. You can stop the container now.
Install Docker Ce Centos 8 Download
I hope this tutorial helped you in installing docker on CentOS. Do subscribe for more Docker tutorials and DevOps tips.
Become a Member for FREE
Install Docker Ce On Centos 8
Install Docker Ce Centos 8 Iso
Join the conversation.