zaki work log

作業ログやら生活ログやらなんやら

(作業ログ) RHEL 8.5へのDocker 20.10インストール

諸事情でRHELでPodmanでなくDockerを使う必要があったため、インストールした時の作業ログ。

状況

speakerdeck.com

そして現在(Docker 20.10)の状況としては、RHEL向けのパッケージはないけれど、CentOS 8用であればバイナリ互換の他のOSでも動くらしい…ということでRHEL8.5へのインストールを確認してみた。

logmi.jp

環境

[zaki@rhel8 ~]$ cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.5 (Ootpa)

手順

docs.docker.com

以下は、このリンクにのってる手順通りに実施した作業とそのログ。

Dockerのインストール

古いバージョンの削除

[zaki@rhel8 ~]$ sudo yum remove docker \
>                   docker-client \
>                   docker-client-latest \
>                   docker-common \
>                   docker-latest \
>                   docker-latest-logrotate \
>                   docker-logrotate \
>                   docker-engine
サブスクリプション管理リポジトリーを更新しています。
一致した引数がありません: docker
一致した引数がありません: docker-client
一致した引数がありません: docker-client-latest
一致した引数がありません: docker-common
一致した引数がありません: docker-latest
一致した引数がありません: docker-latest-logrotate
一致した引数がありません: docker-logrotate
一致した引数がありません: docker-engine
削除対象のパッケージはありません。
依存関係が解決しました。
行うべきことはありません。
完了しました!

リポジトリのセットアップ

[zaki@rhel8 ~]$ sudo yum install -y yum-utils
サブスクリプション管理リポジトリーを更新しています。
メタデータの期限切れの最終確認: 1:49:22 時間前の 2022年10月04日 11時41分55秒 に実施しました。
パッケージ yum-utils-4.0.21-4.el8_5.noarch は既にインストールされています。
依存関係が解決しました。
=================================================================================================================================
 パッケージ                         アーキテクチャー バージョン                    リポジトリー                            サイズ
=================================================================================================================================
アップグレード:
 dnf                                noarch           4.7.0-8.el8                   rhel-8-for-x86_64-baseos-rpms           541 k
 dnf-data                           noarch           4.7.0-8.el8                   rhel-8-for-x86_64-baseos-rpms           155 k
 dnf-plugins-core                   noarch           4.0.21-11.el8                 rhel-8-for-x86_64-baseos-rpms            71 k
 json-c                             x86_64           0.13.1-3.el8                  rhel-8-for-x86_64-baseos-rpms            41 k
 libdnf                             x86_64           0.63.0-8.2.el8_6              rhel-8-for-x86_64-baseos-rpms           706 k
 python3-dnf                        noarch           4.7.0-8.el8                   rhel-8-for-x86_64-baseos-rpms           545 k
 python3-dnf-plugins-core           noarch           4.0.21-11.el8                 rhel-8-for-x86_64-baseos-rpms           240 k
 python3-hawkey                     x86_64           0.63.0-8.2.el8_6              rhel-8-for-x86_64-baseos-rpms           117 k
 python3-libdnf                     x86_64           0.63.0-8.2.el8_6              rhel-8-for-x86_64-baseos-rpms           778 k
 yum                                noarch           4.7.0-8.el8                   rhel-8-for-x86_64-baseos-rpms           202 k
 yum-utils                          noarch           4.0.21-11.el8                 rhel-8-for-x86_64-baseos-rpms            73 k

トランザクションの概要
=================================================================================================================================
アップグレード  11 パッケージ

ダウンロードサイズの合計: 3.4 M
[zaki@rhel8 ~]$ sudo yum-config-manager \
>     --add-repo \
>     https://download.docker.com/linux/centos/docker-ce.repo
サブスクリプション管理リポジトリーを更新しています。
repo の追加: https://download.docker.com/linux/centos/docker-ce.repo

Dockerのインストール

[zaki@rhel8 ~]$ sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
サブスクリプション管理リポジトリーを更新しています。
Docker CE Stable - x86_64                                                                                                         497 kB/s |  27 kB     00:00    
依存関係が解決しました。
==================================================================================================================================================================
 パッケージ                              アーキテクチャー  バージョン                                           リポジトリー                                サイズ
==================================================================================================================================================================
インストール:
 containerd.io                           x86_64            1.6.8-3.1.el8                                        docker-ce-stable                             33 M
 docker-ce                               x86_64            3:20.10.18-3.el8                                     docker-ce-stable                             21 M
 docker-ce-cli                           x86_64            1:20.10.18-3.el8                                     docker-ce-stable                             30 M
 docker-compose-plugin                   x86_64            2.10.2-3.el8                                         docker-ce-stable                            7.2 M
依存関係のインストール:
 container-selinux                       noarch            2:2.188.0-1.module+el8.6.0+15917+093ca6f8            rhel-8-for-x86_64-appstream-rpms             59 k
 docker-ce-rootless-extras               x86_64            20.10.18-3.el8                                       docker-ce-stable                            4.6 M
 fuse-overlayfs                          x86_64            1.9-1.module+el8.6.0+15917+093ca6f8                  rhel-8-for-x86_64-appstream-rpms             73 k
 fuse3                                   x86_64            3.2.1-12.el8                                         rhel-8-for-x86_64-baseos-rpms                50 k
 fuse3-libs                              x86_64            3.3.0-15.el8                                         rhel-8-for-x86_64-baseos-rpms                95 k
 libslirp                                x86_64            4.4.0-1.module+el8.6.0+15875+dc9a2b96                rhel-8-for-x86_64-appstream-rpms             70 k
 policycoreutils-python-utils            noarch            2.9-16.el8                                           rhel-8-for-x86_64-baseos-rpms               252 k
 slirp4netns                             x86_64            1.2.0-2.module+el8.6.0+15917+093ca6f8                rhel-8-for-x86_64-appstream-rpms             54 k
弱い依存関係のインストール:
 docker-scan-plugin                      x86_64            0.17.0-3.el8                                         docker-ce-stable                            3.8 M
モジュールストリームの有効化中:
 container-tools                                           rhel8                                                                                                 

トランザクションの概要
==================================================================================================================================================================
インストール  13 パッケージ

ダウンロードサイズの合計: 100 M
インストール後のサイズ: 389 M
これでよろしいですか? [y/N]: 

Dockerの開始

[zaki@rhel8 ~]$ sudo systemctl enable --now docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
[zaki@rhel8 ~]$ sudo systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2022-10-04 13:39:51 JST; 3s ago
     Docs: https://docs.docker.com
 Main PID: 19283 (dockerd)
    Tasks: 8
   Memory: 24.9M
   CGroup: /system.slice/docker.service
           └─19283 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

:
:

動作確認

[zaki@rhel8 ~]$ sudo docker run -p 8080:80 -d httpd
Unable to find image 'httpd:latest' locally
latest: Pulling from library/httpd
31b3f1ad4ce1: Pull complete 
f29089ecfcbf: Pull complete 
a9fcd580ef1c: Pull complete 
a19138bf3164: Pull complete 
5bfb2ce98078: Pull complete 
Digest: sha256:71e882df50adc606c57e46e5deb3c933288e2c7775472a639326d9e4e40a47c2
Status: Downloaded newer image for httpd:latest
8ff93381edc8c3924d5eeb0d15d430c9296ab1cdde39176e23019e155c582d82
[zaki@rhel8 ~]$ curl localhost:8080
<html><body><h1>It works!</h1></body></html>

ということで、問題なく動きました。
docker composeもOKです。

[zaki@rhel8 ~]$ docker --version
Docker version 20.10.18, build b40c2f6
[zaki@rhel8 ~]$ docker compose version
Docker Compose version v2.10.2