CentOS 8.1.1911にDocker CEをインストールしようとしたらつまずいたので何とかした

CentOS 8.1.1911にDocker CEをインストールしようとしたらつまずいたので何とかした Tips
スポンサーリンク

CentOS 8.1.1911にDocker CEをインストールしようとしたらつまずいたので何とかした

そろそろCentOS 8に慣れないとなぁと思い、ローカルのDocker環境を置き換えよう、と思い立ったのですがいざインストールしてみるとうまくいかず・・・

色々と探してみたところ、libpodのGitHub Issues #4791にたどり着きました。

本記事では備忘も兼ねて上記を参考にしてCentOS 8.1.1911にDocker CEをインストールする手順を紹介します。

リポジトリの追加

CentOS8にDocker CEをインストールするにはまずリポジトリの追加を行います。

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

Docker CEをインストールすると依存関係でエラーに

Docker CEですが、記事執筆段階では下記の様に依存関係でDocker CEの最新バージョンがインストールできないようなので

 Problem 1: 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

–nobestオプションを付けて、依存関係を解決したインストールを行います。

sudo dnf install -y --nobest docker-ce docker-ce-cli

依存関係の次はpodmanとコンフリクトを起こすように・・・

依存関係が解決したからインストールできるだろう!と思い再度実行すると今度はpodman-manpagesとコンフリクトが発生してしまいます・・・

$ sudo dnf install -y --nobest docker-ce docker-ce-cli
CentOS-8 - AppStream                             12 kB/s | 4.3 kB     00:00
CentOS-8 - Base                                  11 kB/s | 3.8 kB     00:00
CentOS-8 - Extras                               4.2 kB/s | 1.5 kB     00:00
Docker CE Stable - x86_64                        96 kB/s | 3.5 kB     00:00
Dependencies resolved.
================================================================================
 Package           Arch       Version                Repository            Size
================================================================================
Installing:
 docker-ce         x86_64     3:19.03.5-3.el7        docker-ce-stable      24 M
Installing dependencies:
 libcgroup         x86_64     0.41-19.el8            BaseOS                70 k
 docker-ce-cli     x86_64     1:19.03.5-3.el7        docker-ce-stable      39 M

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

Total download size: 64 M
Installed size: 273 M
Downloading Packages:
(1/3): libcgroup-0.41-19.el8.x86_64.rpm         1.0 MB/s |  70 kB     00:00
(2/3): docker-ce-cli-19.03.5-3.el7.x86_64.rpm    44 MB/s |  39 MB     00:00
(3/3): docker-ce-19.03.5-3.el7.x86_64.rpm        23 MB/s |  24 MB     00:01
--------------------------------------------------------------------------------
Total                                            50 MB/s |  64 MB     00:01
Running transaction check
Transaction check succeeded.
Running transaction test
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Error: Transaction check error:
  file /usr/share/man/man1/docker-attach.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-build.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-commit.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-container-prune.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-container.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-cp.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-create.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-diff.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-events.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-exec.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-export.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-history.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-image-prune.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-image.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-images.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-import.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-info.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-inspect.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-kill.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-load.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-login.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-logout.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-logs.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-pause.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-port.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-ps.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-pull.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-push.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-restart.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-rm.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-rmi.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-run.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-save.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-search.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-start.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-stats.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-stop.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-system-df.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-system-prune.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-system.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-tag.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-top.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-unpause.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-version.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-volume-create.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-volume-inspect.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-volume-ls.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-volume-prune.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-volume-rm.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-volume.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker-wait.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch
  file /usr/share/man/man1/docker.1.gz from install of docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with file from package podman-manpages-1.4.2-5.module_el8.1.0+237+63e26edc.noarch

そこで、冒頭で紹介したIssuesに載っている対処を行います。

[対処]Docker CEのインストール

まずは下記コマンドでpodmanのパッケージを一旦アンインストールします。

sudo dnf clean packages
sudo yum -y remove podman

続いて、下記コマンドを実行してman page無しでpodmanの依存関係パッケージをインストールします。

sudo yum -y install oci-systemd-hook libvarlink

そして下記コマンドを実行して依存関係を解決せずにpodmanパッケージをインストールします。

sudo rpm -Uvh --nodeps $(repoquery --location podman)

そして最後に下記コマンドを実行することで、Docker CEのインストールおよび、サービスの登録、起動を行う事ができます。

sudo dnf install -y --nobest docker-ce docker-ce-cli
sudo systemctl enable docker
sudo systemctl start docker

上記手順でインストールを行うとDocker CE 19.03.5. build 633a0eaがインストースされます。(2020/02/04現在)

$ docker --version
Docker version 19.03.5, build 633a0ea

まとめ

CentOS 6もそろそろサポート切れるし、いっその事CentOS8を入れてみるかぁと思って試したところ多いにドはまりしてしまいました・・・

この記事が1人でも多くの方の役に立てば幸いです。

コメント

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