Přístavní dělník

Install Docker CE on CentOS 8

Install Docker CE on CentOS 8
Docker CE is officially not supported on Red Hat Enterprise Linux (RHEL) 8 or CentOS 8. The Red Hat's officially recommended way to manage containers on RHEL 8 and CentOS 8 is Podman. Podman is basically a replacement for Docker on RHEL 8 and CentOS 8. Docker images are compatible with Podman though. So, moving to Podman should not be too hard.

Anyway, this article is not about Podman. It's about getting Docker installed on CentOS 8. If you really don't want to switch to Podman and keep using Docker on your RHEL 8 or CentOS 8 machine, then this article is for you.

NOTE: If you're going to use Docker on a production machine, then I recommend you not to upgrade to CentOS 8/RHEL 8. Keep using CentOS 7/RHEL 7 until Docker has official support for RHEL 8 and CentOS 8.

Installing Required Tools:

First, update the CentOS 8 package repository cache with the following command:

$ sudo dnf makecache

Now, install all the tools required for installing Docker CE with the following command:

$ sudo dnf install dnf-utils device-mapper-persistent-data lvm2
fuse-overlayfs wget

To confirm the installation, press Y and then press .

All the required tools should be installed.

Adding Docker CE Official Package Repository:

Docker CE is not available in the official package repository of CentOS 8. But you can add the official Docker CE package repository on CentOS 8 and install Docker from there.

To add the official Docker CE package repository, run the following command:

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

Now, update the CentOS 8 package repository cache with the following command:

$ sudo dnf makecache

Installing Containerd.io:

The main incompatibility of Docker CE on RHEL 8 and CentOS 8 is containerd.io package. Docker CE depends on that package, but RHEL 8 and CentOS 8 officially flagged these packages. So, you can't install the version of containerd.io package that Docker needs to work on RHEL 8 and CentOS 8 using the DNF or YUM package managers directly.

Luckily, we can manually download the latest version of containerd.io package and install it on CentOS 8.

First, navigate to the /tmp directory as follows:

$ cd /tmp

The latest version of containerd.io package is 1.2.6-3.3 at the time of this writing. You may check for a later version when you're reading this article at https://download.docker.com/linux/centos/7/x86_64/stable/Packages/

Now, download the latest version of containerd.io package from the official CentOS 7 package repository of Docker CE with the following command:

$ wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
containerd.io-1.2.6-3.3.el7.x86_64.rpm

The latest version of containerd.io package should be downloaded.

The containerd.io RPM package file should be in the /tmp directory as you can see in the screenshot below.

$ ls -lh containerd.io*

Now, install the containerd.io-1.2.6-3.3.el7.x86_64.rpm package file using DNF package manager as follows:

$ sudo dnf localinstall ./containerd.io-1.2.6-3.3.el7.x86_64.rpm

To confirm the installation, press Y and then press .

The latest version of containerd.io should be installed.

Now, you're ready to install Docker CE on your CentOS 8 machine.

Installing Docker CE:

To install Docker CE on CentOS 8 from the official Docker CE package repository, run the following command:

$ sudo dnf install docker-ce docker-ce-cli

To confirm the installation, press Y and then press .

The DNF package manager should start downloading all the required RPM packages from the Docker CE package repository. It may take a while to complete.

At this point Docker CE should be installed.

Now, check the status of the docker service with the following command:

$ sudo systemctl status docker

The docker service may be inactive (not running) and disabled (won't auto start on boot) as in my case.

To start the docker service, run the following command:

$ sudo systemctl start docker

Also, to automatically start the docker service on system boot, add the docker service to the system startup of CentOS 8 as follows:

$ sudo systemctl enable docker

Now, check the status of the docker service again.

$ sudo systemctl status docker

The docker service should be active (running) and enabled (will auto start on system boot).

You will not want to run Docker commands with sudo or as root user. In order to run Docker commands as your login user, you must add your login user to the docker group.

To add your login user to the docker group, run the following command:

$ sudo usermod -aG docker $(whoami)

Now, reboot your CentOS 8 machine with the following command:

$ sudo reboot

Once your CentOS 8 machine boots, you can check whether Docker is working with the following command:

$ docker version

As you can see, I am running Docker CE 19.03.5. Docker Engine client and server is also working.

Now, let's try to run the hello-world Docker container.

$ docker run hello-world

As you can see, Docker pulled the hello-world container from the internet and ran it successfully.

So, that's how you install Docker CE on CentOS 8. Thanks for reading this article.

V systému Windows 10 nefunguje levé tlačítko myši
Pokud používáte speciální myš s notebookem nebo stolním počítačem, ale levé tlačítko myši nefunguje ve Windows 10/8/7 z nějakého důvodu uvádíme několi...
Kurzor při psaní v systému Windows 10 skáče nebo se pohybuje náhodně
Pokud zjistíte, že kurzor myši skáče nebo se pohybuje sám, automaticky, náhodně při psaní v notebooku nebo počítači se systémem Windows, pak vám někte...
Jak obrátit směr posouvání myši a touchpadu ve Windows 10
Myš a Touchpadnejenže usnadňují výpočet, ale jsou efektivnější a méně časově náročné. Nemůžeme si představit život bez těchto zařízení, ale přesto je ...