CentOS8でdockerをインストールしてみた。

CentOS8でdockerをインストールしてみた。

OSはこれ

# cat /etc/redhat-release
CentOS Linux release 8.1.1911 (Core)

Cent7では普通にyumで入ったのに入りません。。

# dnf install docker
CentOS-8 - AppStream 4.3 kB/s | 4.3 kB 00:00
CentOS-8 - Base 4.3 kB/s | 3.8 kB 00:00
CentOS-8 - Extras 1.6 kB/s | 1.5 kB 00:00
No match for argument: docker
Error: Unable to find a match: docker

docker-ceリポジトリを入れます。

# 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

インストールしてみます。

# dnf install docker-ce
Last metadata expiration check: 0:03:38 ago on Mon 16 Mar 2020 10:13:35 PM JST.
Error:
Problem: package docker-ce-3:19.03.8-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.13-3.1.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)

バージョンで蹴られてしまいました。

なのでcontainerd.ioのリポジトリをいれます。

# dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm
Last metadata expiration check: 0:05:34 ago on Mon 16 Mar 2020 10:13:35 PM JST.
containerd.io-1.2.6-3.3.el7.x86_64.rpm 34 MB/s | 26 MB 00:00
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
containerd.io x86_64 1.2.6-3.3.el7 @commandline 26 M
Installing dependencies:
container-selinux noarch 2:2.124.0-1.module_el8.1.0+272+3e64ee36
AppStream 47 k
checkpolicy x86_64 2.9-1.el8 BaseOS 348 k
policycoreutils-python-utils noarch 2.9-3.el8_1.1 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_1.1 BaseOS 2.2 M
python3-setools x86_64 4.2.2-1.el8 BaseOS 600 k
Enabling module streams:
container-tools rhel8

Transaction Summary
略~

それでは、docker インストールです。

# dnf install docker-ce
Last metadata expiration check: 0:06:41 ago on Mon 16 Mar 2020 10:13:35 PM JST.
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
docker-ce x86_64 3:19.03.8-3.el7 docker-ce-stable 25 M
Installing dependencies:
libcgroup x86_64 0.41-19.el8 BaseOS 70 k
docker-ce-cli x86_64 1:19.03.8-3.el7 docker-ce-stable 40 M

Transaction Summary
================================================================================
Install 3 Packages

Total download size: 64 M
Installed size: 273 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): libcgroup-0.41-19.el8.x86_64.rpm 1.0 MB/s | 70 kB 00:00
(2/3): docker-ce-19.03.8-3.el7.x86_64.rpm 42 MB/s | 25 MB 00:00
(3/3): docker-ce-cli-19.03.8-3.el7.x86_64.rpm 39 MB/s | 40 MB 00:01
--------------------------------------------------------------------------------
Total 42 MB/s | 64 MB 00:01
warning: /var/cache/dnf/docker-ce-stable-091d8a9c23201250/packages/docker-ce-19.03.8-3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Docker CE Stable - x86_64 20 kB/s | 1.6 kB 00:00
Importing GPG key 0x621E9F35:
Userid : "Docker Release (CE rpm) "
Fingerprint: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
From : https://download.docker.com/linux/centos/gpg
Is this ok [y/N]: y
略~
Installed:
docker-ce-3:19.03.8-3.el7.x86_64 libcgroup-0.41-19.el8.x86_64
docker-ce-cli-1:19.03.8-3.el7.x86_64

Complete!

# systemctl enable docker
# systemctl start docker

無事にCentOS8にdockerをインストールできました。