How to Install Docker Engine on CentOS 8

CentOS 8 has reached version 8.2.2004, and Docker officially onlysupply CentOS 7 installation package. What's going on?
I searched online and found that it was because Red Hat launched it themselves. buildah and podman Prepare to replace Docker.
Although the compatibility is good, can you install Docker under CentOS 8?
There is still a way, it just needs to be done manually. Just take a little time and follow the steps in this article.

This article will explain how to install Docker Engine and docker-compose under CentOS 8.

Update log for November 8, 2020:

At the time of writing this article, Docker has not yet officially released the rpm installation package under CentOS 8.
On September 17, 2020, Docker has officially released CentOS 8 rpm installation packageso there is an easier way to install Docker Engine.
Run the following command as root user:

wget -qO- get.docker.com | bash

Version number after installation is complete:

Client: Docker Engine - Community
 Version:           19.03.13
 API version:       1.40
 Go version:        go1.13.15
 Git commit:        4484c46d9d
 Built:             Wed Sep 16 17:02:36 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.13
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       4484c46d9d
  Built:            Wed Sep 16 17:01:11 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.3.7
  GitCommit:        8fba4e9a7d01810a393d5d25a3621dc101981175
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

As for the installation method of docker-compose, you can continue to refer to the method in step 6 below this article.

——-The following is the dividing line of the original text——-

At the time of writing this article, the latest version number of Docker is 19.03.12.

$ docker version
Client: Docker Engine - Community
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        48a66213fe
 Built:             Mon Jun 22 15:46:54 2020
 OS/Arch:           linux/amd64
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          19.03.12
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       48a66213fe
  Built:            Mon Jun 22 15:45:28 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

1. Install docker-ce.repo

The default under CentOS 8 is the dnf command for package management.
The first step is to install the official Docker repo and execute the command as follows:

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

2. Show available versions

$ dnf list docker-ce --showduplicates

Return to the list below.

Available Packages
docker-ce.x86_64    17.03.0.ce-1.el7.centos    docker-ce-stable
docker-ce.x86_64    17.03.1.ce-1.el7.centos    docker-ce-stable
docker-ce.x86_64    17.03.2.ce-1.el7.centos    docker-ce-stable
docker-ce.x86_64    17.03.3.ce-1.el7           docker-ce-stable
docker-ce.x86_64    17.06.0.ce-1.el7.centos    docker-ce-stable
docker-ce.x86_64    17.06.1.ce-1.el7.centos    docker-ce-stable
docker-ce.x86_64    17.06.2.ce-1.el7.centos    docker-ce-stable
docker-ce.x86_64    17.09.0.ce-1.el7.centos    docker-ce-stable
docker-ce.x86_64    17.09.1.ce-1.el7.centos    docker-ce-stable
docker-ce.x86_64    17.12.0.ce-1.el7.centos    docker-ce-stable
docker-ce.x86_64    17.12.1.ce-1.el7.centos    docker-ce-stable
docker-ce.x86_64    18.03.0.ce-1.el7.centos    docker-ce-stable
docker-ce.x86_64    18.03.1.ce-1.el7.centos    docker-ce-stable
docker-ce.x86_64    18.06.0.ce-3.el7           docker-ce-stable
docker-ce.x86_64    18.06.1.ce-3.el7           docker-ce-stable
docker-ce.x86_64    18.06.2.ce-3.el7           docker-ce-stable
docker-ce.x86_64    18.06.3.ce-3.el7           docker-ce-stable
docker-ce.x86_64    3:18.09.0-3.el7            docker-ce-stable
docker-ce.x86_64    3:18.09.1-3.el7            docker-ce-stable
docker-ce.x86_64    3:18.09.2-3.el7            docker-ce-stable
docker-ce.x86_64    3:18.09.3-3.el7            docker-ce-stable
docker-ce.x86_64    3:18.09.4-3.el7            docker-ce-stable
docker-ce.x86_64    3:18.09.5-3.el7            docker-ce-stable
docker-ce.x86_64    3:18.09.6-3.el7            docker-ce-stable
docker-ce.x86_64    3:18.09.7-3.el7            docker-ce-stable
docker-ce.x86_64    3:18.09.8-3.el7            docker-ce-stable
docker-ce.x86_64    3:18.09.9-3.el7            docker-ce-stable
docker-ce.x86_64    3:19.03.0-3.el7            docker-ce-stable
docker-ce.x86_64    3:19.03.1-3.el7            docker-ce-stable
docker-ce.x86_64    3:19.03.2-3.el7            docker-ce-stable
docker-ce.x86_64    3:19.03.3-3.el7            docker-ce-stable
docker-ce.x86_64    3:19.03.4-3.el7            docker-ce-stable
docker-ce.x86_64    3:19.03.5-3.el7            docker-ce-stable
docker-ce.x86_64    3:19.03.6-3.el7            docker-ce-stable
docker-ce.x86_64    3:19.03.7-3.el7            docker-ce-stable
docker-ce.x86_64    3:19.03.8-3.el7            docker-ce-stable
docker-ce.x86_64    3:19.03.9-3.el7            docker-ce-stable
docker-ce.x86_64    3:19.03.10-3.el7           docker-ce-stable
docker-ce.x86_64    3:19.03.11-3.el7           docker-ce-stable
docker-ce.x86_64    3:19.03.12-3.el7           docker-ce-stable

As you can see, as of now, the latest version has reached 19.03.12

3. Install dependencies in advance

To install docker-ce Dependencies must be installed in advance containerd.io, here is the biggest difference from automatic installation under CentOS 7.Clickhereview the latest version of containerd.io. Replace the download link in the command below appropriately.
Execute the following command:

$ dnf install -y https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.13-3.2.el7.x86_64.rpm

4. Install Docker

Execute the following command, note that there is a --nobest Options:

$ dnf install -y --nobest docker-ce

5. Start Docker

After the correct installation in the previous step, the next step is to start Docker and set it to start automatically at boot.
Start Docker command:

$ systemctl start docker

Check Docker status:

$ systemctl status docker

Set the command to automatically start Docker at boot:

$ systemctl enable docker

View Docker version information:

$ docker version

6. Install docker-compose

use pip3 It is easiest to install docker-compose.
Installed in advance pip3 It is necessary. If it is not installed on this machine, execute the following command to install it. pip3

$ dnf install -y python3-pip

View pip3 version information:

$ pip3 --version

return value:

pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)

Install docker-compose command

$ pip3 install docker-compose

View docker-compose version information:

$ docker-compose --version

return value:

docker-compose version 1.26.2, build unknown

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button