How to install docker on CentOS8

What is docker?

Docker is basically a container engine which uses the Linux Kernel in order to create the containers on top of an operating system. Which is use to create, deploy and run the applications

Update packages

  sudo yum update -y

Adding Docker repository

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

Output:

  Adding repo from: https://download.docker.com/linux/centos/docker-ce.repo

Installing docker-ce package

  sudo dnf -y  install docker-ce --nobest

Output:

    Verifying        : containerd.io-1.2.0-3.el7.x86_64                                                                              10/12
    Verifying        : docker-ce-3:18.09.1-3.el7.x86_64                                                                              11/12
    Verifying        : docker-ce-cli-1:19.03.5-3.el7.x86_64                                                                          12/12

  Installed:
    docker-ce-3:18.09.1-3.el7.x86_64                        container-selinux-2:2.94-1.git1e99f1d.module_el8.0.0+58+91b614e7.noarch
    checkpolicy-2.8-2.el8.x86_64                            libcgroup-0.41-19.el8.x86_64
    policycoreutils-python-utils-2.8-16.1.el8.noarch        python3-audit-3.0-0.10.20180831git0047a6c.el8.x86_64
    python3-libsemanage-2.8-5.el8.x86_64                    python3-policycoreutils-2.8-16.1.el8.noarch
    python3-setools-4.2.0-2.el8.x86_64                      tar-2:1.30-4.el8.x86_64
    containerd.io-1.2.0-3.el7.x86_64                        docker-ce-cli-1:19.03.5-3.el7.x86_64

  Skipped:
    docker-ce-3:19.03.5-3.el7.x86_64

  Complete!

Enable the docker service.

  systemctl enable --now docker

Output:

Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service

Check the docker service:

  systemctl status  docker

Output:

  ● docker.service - Docker Application Container Engine
     Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
     Active: active (running) since Sat 2019-11-30 05:45:17 EST; 15min ago
       Docs: https://docs.docker.com
   Main PID: 31701 (dockerd)
      Tasks: 21
     Memory: 65.5M
     CGroup: /system.slice/docker.service
             ├─31701 /usr/bin/dockerd -H fd://
             └─31719 containerd --config /var/run/docker/containerd/containerd.toml --log-level info

  Nov 30 05:45:16 vps.server.com dockerd[31701]: time="2019-11-30T05:45:16.356748363-05:00" level=info msg="Graph migration to content-add>
  Nov 30 05:45:16 vps.server.com dockerd[31701]: time="2019-11-30T05:45:16.357870127-05:00" level=warning msg="Your kernel does not suppor>
  Nov 30 05:45:16 vps.server.com dockerd[31701]: time="2019-11-30T05:45:16.358182793-05:00" level=warning msg="Your kernel does not suppor>
  Nov 30 05:45:16 vps.server.com dockerd[31701]: time="2019-11-30T05:45:16.359440886-05:00" level=info msg="Loading containers: start."
  Nov 30 05:45:17 vps.server.com dockerd[31701]: time="2019-11-30T05:45:17.164195394-05:00" level=info msg="Default bridge (docker0) is as>
  Nov 30 05:45:17 vps.server.com dockerd[31701]: time="2019-11-30T05:45:17.642795447-05:00" level=info msg="Loading containers: done."
  Nov 30 05:45:17 vps.server.com dockerd[31701]: time="2019-11-30T05:45:17.759556269-05:00" level=info msg="Docker daemon" commit=4c52b90 >
  Nov 30 05:45:17 vps.server.com dockerd[31701]: time="2019-11-30T05:45:17.760971934-05:00" level=info msg="Daemon has completed initializ>
  Nov 30 05:45:17 vps.server.com dockerd[31701]: time="2019-11-30T05:45:17.790726821-05:00" level=info msg="API listen on /var/run/docker.>
  Nov 30 05:45:17 vps.server.com systemd[1]: Started Docker Application Container Engine.