Install docker on CentOS8

web

I write the process to install docker&docker-compose on CentOS8 for EC-CUBE.

At first, I want to say that it is better that we install docker on CentOS7 in conclusion.

Install docker in CentOS8

I run the commands as root user.

$ sudo su

Add repository to install docker!

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

Check repository is installed.

dnf repolist -v

It is OK if we can see this content!

...
Repo-id      : docker-ce-stable
Repo-name    : Docker CE Stable - x86_64
Repo-revision: 1573753657
Repo-updated : Thu 14 Nov 2019 05:47:37 PM UTC
Repo-pkgs    : 57
Repo-size    : 1.2 G
Repo-baseurl : https://download.docker.com/linux/centos/7/x86_64/stable
Repo-expire  : 172,800 second(s) (last: Sun 02 Feb 2020 07:37:35 AM UTC)
Repo-filename: /etc/yum.repos.d/docker-ce.repo
...

Install docker!

# dnf install docker-ce

but, I got this error here!

Last metadata expiration check: 0:01:43 ago on Sun 02 Feb 2020 07:37:35 AM UTC.
Error:
 Problem: package docker-ce-3:19.03.5-3.el7.x86_64 requires containerd.io >= 1.2
.2-3, but none of the providers can be installed
  - cannot install the best candidate for the job
  - package containerd.io-1.2.10-3.2.el7.x86_64 is excluded
  - package containerd.io-1.2.2-3.3.el7.x86_64 is excluded
  - package containerd.io-1.2.2-3.el7.x86_64 is excluded
  - package containerd.io-1.2.4-3.1.el7.x86_64 is excluded
  - package containerd.io-1.2.5-3.1.el7.x86_64 is excluded
  - package containerd.io-1.2.6-3.3.el7.x86_64 is excluded
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use
not only best candidate packages)

This seems CentOS8’s repository does not provide containerd.io >= 1.2.2-3.
Therefore, we add –nobest option to install docker on CentOS8!

※ If we add --nobest , we can not install latest version(docker-ce-3:19.03). but, we can install old version(docker-ce-3:18.09).

# dnf -y install docker-ce --nobest
Last metadata expiration check: 0:04:06 ago on Sun 02 Feb 2020 07:37:35 AM UTC.
Dependencies resolved.

 Problem: package docker-ce-3:19.03.5-3.el7.x86_64 requires containerd.io >= 1.2
.2-3, but none of the providers can be installed
  - cannot install the best candidate for the job
  - package containerd.io-1.2.10-3.2.el7.x86_64 is excluded
  - package containerd.io-1.2.2-3.3.el7.x86_64 is excluded
  - package containerd.io-1.2.2-3.el7.x86_64 is excluded
  - package containerd.io-1.2.4-3.1.el7.x86_64 is excluded
  - package containerd.io-1.2.5-3.1.el7.x86_64 is excluded
  - package containerd.io-1.2.6-3.3.el7.x86_64 is excluded
================================================================================

 Package                      Arch   Version             Repository        Size
================================================================================

Installing:
 docker-ce                    x86_64 3:18.09.1-3.el7     docker-ce-stable  19 M
Installing dependencies:
 container-selinux            noarch 2:2.107-2.module_el8.1.0+237+63e26edc
                                                         AppStream         44 k
 checkpolicy                  x86_64 2.9-1.el8           BaseOS           348 k
 libcgroup                    x86_64 0.41-19.el8         BaseOS            70 k
 policycoreutils-python-utils noarch 2.9-3.el8           BaseOS           250 k
 python3-audit                x86_64 3.0-0.10.20180831git0047a6c.el8
                                                         BaseOS            85 k
 python3-libsemanage          x86_64 2.9-1.el8           BaseOS           127 k
 python3-policycoreutils      noarch 2.9-3.el8           BaseOS           2.2 M
 python3-setools              x86_64 4.2.2-1.el8         BaseOS           600 k
 containerd.io                x86_64 1.2.0-3.el7         docker-ce-stable  22 M
 docker-ce-cli                x86_64 1:19.03.5-3.el7     docker-ce-stable  39 M
Enabling module streams:
 container-tools                     rhel8
Skipping packages with broken dependencies:
 docker-ce                    x86_64 3:19.03.5-3.el7     docker-ce-stable  24 M

Transaction Summary
================================================================================

Install  11 Packages
Skip      1 Package

...

Running transaction
  Preparing        :                                                        1/1

  Installing       : docker-ce-cli-1:19.03.5-3.el7.x86_64                  1/11

  Running scriptlet: docker-ce-cli-1:19.03.5-3.el7.x86_64                  1/11

  Installing       : containerd.io-1.2.0-3.el7.x86_64                      2/11

  Running scriptlet: containerd.io-1.2.0-3.el7.x86_64                      2/11

  Installing       : python3-setools-4.2.2-1.el8.x86_64                    3/11

  Installing       : python3-libsemanage-2.9-1.el8.x86_64                  4/11

  Installing       : python3-audit-3.0-0.10.20180831git0047a6c.el8.x86_    5/11

  Running scriptlet: libcgroup-0.41-19.el8.x86_64                          6/11

  Installing       : libcgroup-0.41-19.el8.x86_64                          6/11

  Running scriptlet: libcgroup-0.41-19.el8.x86_64                          6/11

  Installing       : checkpolicy-2.9-1.el8.x86_64                          7/11

  Installing       : python3-policycoreutils-2.9-3.el8.noarch              8/11

  Installing       : policycoreutils-python-utils-2.9-3.el8.noarch         9/11

  Installing       : container-selinux-2:2.107-2.module_el8.1.0+237+63e   10/11

  Running scriptlet: container-selinux-2:2.107-2.module_el8.1.0+237+63e   10/11

  Running scriptlet: docker-ce-3:18.09.1-3.el7.x86_64                     11/11

  Installing       : docker-ce-3:18.09.1-3.el7.x86_64                     11/11

  Running scriptlet: docker-ce-3:18.09.1-3.el7.x86_64                     11/11

  Verifying        : container-selinux-2:2.107-2.module_el8.1.0+237+63e    1/11

  Verifying        : checkpolicy-2.9-1.el8.x86_64                          2/11

  Verifying        : libcgroup-0.41-19.el8.x86_64                          3/11

  Verifying        : policycoreutils-python-utils-2.9-3.el8.noarch         4/11

  Verifying        : python3-audit-3.0-0.10.20180831git0047a6c.el8.x86_    5/11

  Verifying        : python3-libsemanage-2.9-1.el8.x86_64                  6/11

  Verifying        : python3-policycoreutils-2.9-3.el8.noarch              7/11

  Verifying        : python3-setools-4.2.2-1.el8.x86_64                    8/11

  Verifying        : containerd.io-1.2.0-3.el7.x86_64                      9/11

  Verifying        : docker-ce-3:18.09.1-3.el7.x86_64                     10/11

  Verifying        : docker-ce-cli-1:19.03.5-3.el7.x86_64                 11/11

Installed:
  docker-ce-3:18.09.1-3.el7.x86_64

  container-selinux-2:2.107-2.module_el8.1.0+237+63e26edc.noarch

  checkpolicy-2.9-1.el8.x86_64

  libcgroup-0.41-19.el8.x86_64

  policycoreutils-python-utils-2.9-3.el8.noarch

  python3-audit-3.0-0.10.20180831git0047a6c.el8.x86_64

  python3-libsemanage-2.9-1.el8.x86_64

  python3-policycoreutils-2.9-3.el8.noarch

  python3-setools-4.2.2-1.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!

Check docker daemon’s status!

# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor pre>
   Active: inactive (dead)
     Docs: https://docs.docker.com

Set to run docker when CentOS8 starts up.

# systemctl enable docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /u
sr/lib/systemd/system/docker.service.

Check docker’s status! If we can see enabled, it is OK!

# systemctl is-enabled docker
enabled

Install docker compose on CentOS8

Let’s download latest version of docker compose from Git repository!

We can check latest version at release note . On 2020/02/02, the latest version is 1.25.3!

# curl -L https://github.com/docker/compose/releases/download/1.25.3/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

After download, add +x to binary file to run docker-compose command.

# chmod +x /usr/local/bin/docker-compose

Run this command to check command works.

# /usr/local/bin/docker-compose --version
docker-compose version 1.25.3, build d4d1b42b

Add path /usr/local/bin in root user’s bash_profile.

# vi ~/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/usr/local/bin/

export PATH

Reflect .bash_profilesetting!

# source ~/.bash_profile

Check the command run by root user!

# docker-compose --version
docker-compose version 1.25.3, build d4d1b42b

Reference

CentOS8でDockerCEをinstallする
How to install Docker CE on RHEL 8 / CentOS 8

タイトルとURLをコピーしました