In this article, we will have explained the necessary steps to install Docker on CentOS 8. Before continuing with this tutorial, make sure you are logged in as a user with
sudo privileges. All the commands in this tutorial should be run as a non-root user.
Docker is an open-source project which allows the creation and distribution of applications inside containers, which are standardized environments that can be easily replicated, independently from the host system.
Install Docker on CentOS 8
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
sudo dnf install epel-release sudo dnf update
Step 2. Install Docker on CentOS.
Now, we add the Docker repository:
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
Verify that the repository has been enabled by typing the following
$ sudo dnf repolist -v .... Repo-id : docker-ce-stable Repo-name : Docker CE Stable - x86_64 Repo-revision: 1567619328 Repo-updated : Mon 11 Nov 2019 05:46:36 PM UTC Repo-pkgs : 51 Repo-size : 1.1 G Repo-baseurl : https://download.docker.com/linux/centos/7/x86_64/stable Repo-expire : 146,600 second(s) (last: Mon 04 Oct 2019 09:46:36 PM UTC) Repo-filename: /etc/yum.repos.d/docker-ce.repo
Install Docker using the following command:
sudo dnf -y install docker-ce --nobest
Now we must enable docker service:
sudo systemctl enable --now docker
You can check the Docker service status using the following
sudo systemctl status docker
The output should be similar to the following, showing that the service is active and running:
docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor pres> Active: active (running) since Sun 2019-11-11 18:00:45 UTC; 1min 32s ago Docs: https://docs.docker.com Main PID: 2856 (dockerd) Tasks: 24 Memory: 53.2M CGroup: /system.slice/docker.service ├─2826 /usr/bin/dockerd -H fd:// └─2823 containerd --config /var/run/docker/containerd/containerd.tom>
Finally, add your user to the docker group with the command:
sudo usermod -aG docker $USER
That’s all you need to do to install Docker on CentOS 8. I hope you find this quick tip helpful. For further reading on Docker, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.