How To Install Docker on CentOS 8

Install Docker on CentOS 8

In this tutorial, we will show you how to install Docker on CentOS 8. For those of you who didn’t know, Docker is an open-source tool that makes creating and managing Linux containers (LXC) easy. With Docker, the applications reside inside the container on top of the Linux operating system. Docker uses Kernel features such as groups and namespace to allow the independent container to run on a single os instance.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Docker on a CentOS 8 server.

Install Docker on CentOS 8

Step 1. First, let’s start by ensuring your system is up-to-date.

sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf update

Step 2. Installing Docker on CentOS.

There are two editions of Docker available.

  • Community Edition (CE): ideal for individual developers and small teams looking to get started with Docker and experimenting with container-based apps.
  • Enterprise Edition (EE): Designed for enterprise development and IT teams who build, ship, and run business-critical applications in production at scale.

The Docker Enterprise Edition requires an active license to use. In this guide, we will install Docker CE on CentOS 8. Let’s add a Docker repository before we can install it:

sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

Verify the repository has been enabled:

sudo dnf repolist -v
Repo-id      : docker-ce-stable
Repo-name    : Docker CE Stable - x86_64
Repo-revision: 1549905809
Repo-updated : Mon 16 May 2019 06:23:29 PM CET
Repo-pkgs    : 30
Repo-size    : 618 M
Repo-baseurl : https://download.docker.com/linux/centos/7/x86_64/stable
Repo-expire  : 172,800 second(s) (last: Mon 14 May 2019 10:23:54 AM CET)
Repo-filename: /etc/yum.repos.d/docker-ce.repo

Repo-id      : rhel-8-for-x86_64-appstream-rpms
Repo-name    : Red Hat Enterprise Linux 8 for x86_64 - AppStream Beta (RPMs)
Repo-revision: 154120694
Repo-updated : Wed 28 Oct 2019 02:24:54 AM CET
Repo-pkgs    : 4,594
Repo-size    : 4.9 G
Repo-baseurl : https://cdn.redhat.com/content/beta/rhel8/8/x86_64/appstream/os
Repo-expire  : 86,400 second(s) (last: Mon 14 Feb 2019 10:23:55 AM CET)
Repo-filename: /etc/yum.repos.d/redhat.repo

Repo-id      : rhel-8-for-x86_64-baseos-rpms
Repo-name    : Red Hat Enterprise Linux 8 for x86_64 - BaseOS Beta (RPMs)
Repo-revision: 154120694
Repo-updated : Wed 28 Oct 2019 02:25:19 AM CET
Repo-pkgs    : 1,686
Repo-size    : 925 M
Repo-baseurl : https://cdn.redhat.com/content/beta/rhel8/8/x86_64/baseos/os
Repo-expire  : 86,400 second(s) (last: Mon 14 Feb 2019 10:23:56 AM CET)
Repo-filename: /etc/yum.repos.d/redhat.repo
Total packages: 6,310

The docker-ce-stable a repository is now enabled on our system. The repository contains several versions of the docker-ce package, to display all of them, we can run:

sudo dnf list docker-ce --showduplicates | sort -r

You can install the latest version of the docker ce using the below command:

sudo dnf install docker-ce

To install a specific version, all we have to do is to provide the fully qualified package name, for example:

sudo dnf install docker-ce-3:19.03.1-3.el7

The next step is to start and enable docker using systemctl:

sudo systemctl enable --now docker
sudo systemctl is-enabled docker

Congratulations! You have successfully installed Docker. Thanks for using this tutorial for installing Docker on CentOS 8 system. For additional help or useful information, we recommend you check the official Docker website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!