CentOSLinuxTutorials

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.

Prerequisites

  • A server running one of the following operating systems: CentOS 8.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

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!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button