Docker Community EditionのRHEL7への導入

Docker Community EditionをRHEL7に導入しました。
以下のCentOSの手順を参考にしましたが、そのままでは動かないところがあったので、参考までに記録を残しました。

https://docs.docker.com/engine/install/centos/

そもそもRHELがサポートされていないようにも思えますので、ご利用条件などはご自身でご確認ください。

https://docs.docker.com/engine/install/#server

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/223763/b213210a-795a-7566-d079-ea80d91b5eb9.png)

一般的にdockerを使いたいということであれば、RHEL7.xの標準yumパッケージとして存在するdockerを入れるのが本来的かと思います。ただ、CEではないので若干古いものになると思われます。以下は標準yumパッケージのdockerを導入する記事です。

https://qiita.com/kawada2017/items/c6fd464aceffd55d67b2


■環境
RHEL 7.9
Docker CE 3:20.10.5-3.el7

## 前提環境の準備

既存のdockerが導入されていないことを以下で確認します。

```bash:コマンド
yum list installed|grep docker
```

```console:結果
[root@anaconda ~]# yum list installed|grep docker
[root@anaconda ~]#
```

### yumにDockerのレポジトリを追加

導入方法はいくつかありますが、ここではyumにDockerのレポジトリを追加する方法で導入します。
yum-utils パッケージ (yum-config-manager ユーティリティ) をインストールします。

```bash:コマンド
sudo yum install -y yum-utils
```

```console:結果
[root@anaconda ~]# sudo yum install -y yum-utils
Loaded plugins: product-id, search-disabled-repos, subscription-manager
rhel-7-server-optional-rpms                                                                                                                                                      | 1.8 kB  00:00:00
rhel-7-server-rpms                                                                                                                                                               | 2.0 kB  00:00:00
rhel-7-server-supplementary-rpms                                                                                                                                                 | 2.0 kB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package yum-utils.noarch 0:1.1.31-54.el7_8 will be installed
--> Processing Dependency: python-kitchen for package: yum-utils-1.1.31-54.el7_8.noarch
--> Running transaction check
---> Package python-kitchen.noarch 0:1.1.1-5.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================================================
 Package                                          Arch                                     Version                                           Repository                                            Size
========================================================================================================================================================================================================
Installing:
 yum-utils                                        noarch                                   1.1.31-54.el7_8                                   rhel-7-server-rpms                                   122 k
Installing for dependencies:
 python-kitchen                                   noarch                                   1.1.1-5.el7                                       rhel-7-server-rpms                                   266 k

Transaction Summary
========================================================================================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 388 k
Installed size: 1.7 M
Downloading packages:
warning: /var/cache/yum/x86_64/7Server/rhel-7-server-rpms/packages/python-kitchen-1.1.1-5.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Public key for python-kitchen-1.1.1-5.el7.noarch.rpm is not installed
(1/2): python-kitchen-1.1.1-5.el7.noarch.rpm                                                                                                                                     | 266 kB  00:00:00
(2/2): yum-utils-1.1.31-54.el7_8.noarch.rpm                                                                                                                                      | 122 kB  00:00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                   1.0 MB/s | 388 kB  00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Importing GPG key 0xFD431D51:
 Userid     : "Red Hat, Inc. (release key 2) <security@redhat.com>"
 Fingerprint: 567e 347a d004 4ade 55ba 8a5f 199e 2f91 fd43 1d51
 Package    : redhat-release-server-7.9-3.el7.x86_64 (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Importing GPG key 0x2FA658E0:
 Userid     : "Red Hat, Inc. (auxiliary key) <security@redhat.com>"
 Fingerprint: 43a6 e49c 4a38 f4be 9abf 2a53 4568 9c88 2fa6 58e0
 Package    : redhat-release-server-7.9-3.el7.x86_64 (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python-kitchen-1.1.1-5.el7.noarch                                                                                                                                                    1/2
  Installing : yum-utils-1.1.31-54.el7_8.noarch                                                                                                                                                     2/2
  Verifying  : python-kitchen-1.1.1-5.el7.noarch                                                                                                                                                    1/2
  Verifying  : yum-utils-1.1.31-54.el7_8.noarch                                                                                                                                                     2/2
rhel-7-server-rpms/7Server/x86_64/productid                                                                                                                                      | 2.1 kB  00:00:00
rhel-7-server-supplementary-rpms/7Server/x86_64/productid                                                                                                                        | 2.1 kB  00:00:00

Installed:
  yum-utils.noarch 0:1.1.31-54.el7_8

Dependency Installed:
  python-kitchen.noarch 0:1.1.1-5.el7

Complete!
```

導入のためにはRed Hat Enterprise Linux 7 Server - Extras (RPMs)を有効にする必要がありました。overlayのドライバーなどはここから導入されます。

```bash:コマンド
sudo subscription-manager repos --enable rhel-7-server-extras-rpms
```

```console:結果
[root@anaconda ~]# sudo subscription-manager repos --enable rhel-7-server-extras-rpms
Repository 'rhel-7-server-extras-rpms' is enabled for this system.
```

Dockerのリポジトリを設定します。

```bash:コマンド
sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
yum repolist all
```
```console:結果
[root@anaconda ~]# sudo yum-config-manager \
>     --add-repo \
>     https://download.docker.com/linux/centos/docker-ce.repo
Loaded plugins: product-id, subscription-manager
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
[root@anaconda ~]# yum repolist all
Loaded plugins: product-id, search-disabled-repos, subscription-manager
https://download.docker.com/linux/centos/7Server/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.

https://download.docker.com/linux/centos/7Server/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
rhel-7-server-optional-rpms/7Server/x86_64                                                                                                                                       | 1.8 kB  00:00:00
rhel-7-server-rpms/7Server/x86_64                                                                                                                                                | 2.0 kB  00:00:00
rhel-7-server-supplementary-rpms/7Server/x86_64                                                                                                                                  | 2.0 kB  00:00:00
repo id                                                               repo name                                                                                                          status
docker-ce-nightly/7Server/x86_64                                      Docker CE Nightly - x86_64                                                                                         disabled
docker-ce-nightly-debuginfo/7Server/x86_64                            Docker CE Nightly - Debuginfo x86_64                                                                               disabled
docker-ce-nightly-source/7Server                                      Docker CE Nightly - Sources                                                                                        disabled
docker-ce-stable/7Server/x86_64                                       Docker CE Stable - x86_64                                                                                          enabled:      0
docker-ce-stable-debuginfo/7Server/x86_64                             Docker CE Stable - Debuginfo x86_64                                                                                disabled
docker-ce-stable-source/7Server                                       Docker CE Stable - Sources                                                                                         disabled
docker-ce-test/7Server/x86_64                                         Docker CE Test - x86_64                                                                                            disabled
docker-ce-test-debuginfo/7Server/x86_64                               Docker CE Test - Debuginfo x86_64                                                                                  disabled
docker-ce-test-source/7Server                                         Docker CE Test - Sources                                                                                           disabled
rhel-7-server-debug-rpms/7Server/x86_64                               Red Hat Enterprise Linux 7 Server (Debug RPMs)                                                                     disabled
rhel-7-server-eus-optional-rpms/7Server/x86_64                        Red Hat Enterprise Linux 7 Server - Extended Update Support - Optional (RPMs)                                      disabled
rhel-7-server-eus-rpms/7Server/x86_64                                 Red Hat Enterprise Linux 7 Server - Extended Update Support (RPMs)                                                 disabled
rhel-7-server-eus-supplementary-rpms/7Server/x86_64                   Red Hat Enterprise Linux 7 Server - Extended Update Support - Supplementary (RPMs)                                 disabled
rhel-7-server-extras-rpms/x86_64                                     Red Hat Enterprise Linux 7 Server - Extras (RPMs)                                                                  enabled:  1,359
rhel-7-server-optional-rpms/7Server/x86_64                            Red Hat Enterprise Linux 7 Server - Optional (RPMs)                                                                enabled: 22,749
rhel-7-server-rh-common-rpms/7Server/x86_64                           Red Hat Enterprise Linux 7 Server - RH Common (RPMs)                                                               disabled
rhel-7-server-rpms/7Server/x86_64                                     Red Hat Enterprise Linux 7 Server (RPMs)                                                                           enabled: 31,446
rhel-7-server-supplementary-rpms/7Server/x86_64                       Red Hat Enterprise Linux 7 Server - Supplementary (RPMs)                                                           enabled:    407
rhel-ha-for-rhel-7-server-eus-rpms/7Server/x86_64                     Red Hat Enterprise Linux High Availability (for RHEL 7 Server) - Extended Update Support (RPMs)                    disabled
rhel-ha-for-rhel-7-server-rpms/7Server/x86_64                         Red Hat Enterprise Linux High Availability (for RHEL 7 Server) (RPMs)                                              disabled
rhel-rs-for-rhel-7-server-eus-rpms/7Server/x86_64                     Red Hat Enterprise Linux Resilient Storage (for RHEL 7 Server) - Extended Update Support (RPMs)                    disabled
rhel-server-rhscl-7-rpms/7Server/x86_64                               Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server                                            disabled
repolist: 54,602
[root@anaconda ~]#
```

[Errno 14] HTTPS Error 404 - Not Found Trying other mirror.が発生しました。CentOSではなくRHELなので、”7Server”のパスが通っていないようなので修正します。

＜参照＞
Docker CE Stable - x86_64 Repo not available : HTTPS Error 404 - Not Found - https://download.docker.com/linux/centos/7Server/x86_64/stable/repodata/repomd.xml - General Discussions - Docker Forums
https://forums.docker.com/t/docker-ce-stable-x86-64-repo-not-available-https-error-404-not-found-https-download-docker-com-linux-centos-7server-x86-64-stable-repodata-repomd-xml/98965/8

```bash:コマンド

cp /etc/yum.repos.d/docker-ce.repo　/etc/yum.repos.d/docker-ce.repo.org
sed -i 's/$releasever/7/g' /etc/yum.repos.d/docker-ce.repo
yum repolist all
```
```console:結果
[root@anaconda ~]# yum repolist all
Loaded plugins: product-id, search-disabled-repos, subscription-manager
repo id                                                               repo name                                                                                                          status
docker-ce-nightly/x86_64                                              Docker CE Nightly - x86_64                                                                                         disabled
docker-ce-nightly-debuginfo/x86_64                                    Docker CE Nightly - Debuginfo x86_64                                                                               disabled
docker-ce-nightly-source                                              Docker CE Nightly - Sources                                                                                        disabled
docker-ce-stable/x86_64                                               Docker CE Stable - x86_64                                                                                          enabled:    108
docker-ce-stable-debuginfo/x86_64                                     Docker CE Stable - Debuginfo x86_64                                                                                disabled
docker-ce-stable-source                                               Docker CE Stable - Sources                                                                                         disabled
docker-ce-test/x86_64                                                 Docker CE Test - x86_64                                                                                            disabled
docker-ce-test-debuginfo/x86_64                                       Docker CE Test - Debuginfo x86_64                                                                                  disabled
docker-ce-test-source                                                 Docker CE Test - Sources                                                                                           disabled
rhel-7-server-debug-rpms/7Server/x86_64                               Red Hat Enterprise Linux 7 Server (Debug RPMs)                                                                     disabled
rhel-7-server-eus-optional-rpms/7Server/x86_64                        Red Hat Enterprise Linux 7 Server - Extended Update Support - Optional (RPMs)                                      disabled
rhel-7-server-eus-rpms/7Server/x86_64                                 Red Hat Enterprise Linux 7 Server - Extended Update Support (RPMs)                                                 disabled
rhel-7-server-eus-supplementary-rpms/7Server/x86_64                   Red Hat Enterprise Linux 7 Server - Extended Update Support - Supplementary (RPMs)                                 disabled
!rhel-7-server-extras-rpms/x86_64                                     Red Hat Enterprise Linux 7 Server - Extras (RPMs)                                                                  enabled:  1,359
!rhel-7-server-optional-rpms/7Server/x86_64                           Red Hat Enterprise Linux 7 Server - Optional (RPMs)                                                                enabled: 22,749
rhel-7-server-rh-common-rpms/7Server/x86_64                           Red Hat Enterprise Linux 7 Server - RH Common (RPMs)                                                               disabled
!rhel-7-server-rpms/7Server/x86_64                                    Red Hat Enterprise Linux 7 Server (RPMs)                                                                           enabled: 31,446
!rhel-7-server-supplementary-rpms/7Server/x86_64                      Red Hat Enterprise Linux 7 Server - Supplementary (RPMs)                                                           enabled:    407
rhel-ha-for-rhel-7-server-eus-rpms/7Server/x86_64                     Red Hat Enterprise Linux High Availability (for RHEL 7 Server) - Extended Update Support (RPMs)                    disabled
rhel-ha-for-rhel-7-server-rpms/7Server/x86_64                         Red Hat Enterprise Linux High Availability (for RHEL 7 Server) (RPMs)                                              disabled
rhel-rs-for-rhel-7-server-eus-rpms/7Server/x86_64                     Red Hat Enterprise Linux Resilient Storage (for RHEL 7 Server) - Extended Update Support (RPMs)                    disabled
rhel-server-rhscl-7-rpms/7Server/x86_64                               Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server                                            disabled
repolist: 56,069
[root@anaconda ~]#
```



## 導入
以下のコマンドでdocker CEを導入します。

```bash:コマンド
sudo yum install docker-ce docker-ce-cli containerd.io	
```
```console:結果
[root@anaconda ~]# sudo yum install docker-ce docker-ce-cli containerd.io
Loaded plugins: product-id, search-disabled-repos, subscription-manager
rhel-7-server-extras-rpms                                                                                                                                                        | 2.0 kB  00:00:00
rhel-7-server-optional-rpms                                                                                                                                                      | 1.8 kB  00:00:00
rhel-7-server-rpms                                                                                                                                                               | 2.0 kB  00:00:00
rhel-7-server-supplementary-rpms                                                                                                                                                 | 2.0 kB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package containerd.io.x86_64 0:1.4.4-3.1.el7 will be installed
--> Processing Dependency: container-selinux >= 2:2.74 for package: containerd.io-1.4.4-3.1.el7.x86_64
--> Processing Dependency: libseccomp for package: containerd.io-1.4.4-3.1.el7.x86_64
---> Package docker-ce.x86_64 3:20.10.5-3.el7 will be installed
--> Processing Dependency: docker-ce-rootless-extras for package: 3:docker-ce-20.10.5-3.el7.x86_64
---> Package docker-ce-cli.x86_64 1:20.10.5-3.el7 will be installed
--> Running transaction check
---> Package container-selinux.noarch 2:2.119.2-1.911c772.el7_8 will be installed
---> Package docker-ce-rootless-extras.x86_64 0:20.10.5-3.el7 will be installed
--> Processing Dependency: fuse-overlayfs >= 0.7 for package: docker-ce-rootless-extras-20.10.5-3.el7.x86_64
--> Processing Dependency: slirp4netns >= 0.4 for package: docker-ce-rootless-extras-20.10.5-3.el7.x86_64
---> Package libseccomp.x86_64 0:2.3.1-4.el7 will be installed
--> Running transaction check
---> Package fuse-overlayfs.x86_64 0:0.7.2-6.el7_8 will be installed
--> Processing Dependency: libfuse3.so.3(FUSE_3.2)(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64
--> Processing Dependency: libfuse3.so.3(FUSE_3.0)(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64
--> Processing Dependency: libfuse3.so.3()(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64
---> Package slirp4netns.x86_64 0:0.4.3-4.el7_8 will be installed
--> Running transaction check
---> Package fuse3-libs.x86_64 0:3.6.1-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================================================
 Package                                              Arch                              Version                                              Repository                                            Size
========================================================================================================================================================================================================
Installing:
 containerd.io                                        x86_64                            1.4.4-3.1.el7                                        docker-ce-stable                                      33 M
 docker-ce                                            x86_64                            3:20.10.5-3.el7                                      docker-ce-stable                                      27 M
 docker-ce-cli                                        x86_64                            1:20.10.5-3.el7                                      docker-ce-stable                                      33 M
Installing for dependencies:
 container-selinux                                    noarch                            2:2.119.2-1.911c772.el7_8                            rhel-7-server-extras-rpms                             40 k
 docker-ce-rootless-extras                            x86_64                            20.10.5-3.el7                                        docker-ce-stable                                     9.1 M
 fuse-overlayfs                                       x86_64                            0.7.2-6.el7_8                                        rhel-7-server-extras-rpms                             55 k
 fuse3-libs                                           x86_64                            3.6.1-4.el7                                          rhel-7-server-extras-rpms                             82 k
 libseccomp                                           x86_64                            2.3.1-4.el7                                          rhel-7-server-rpms                                    56 k
 slirp4netns                                          x86_64                            0.4.3-4.el7_8                                        rhel-7-server-extras-rpms                             82 k

Transaction Summary
========================================================================================================================================================================================================
Install  3 Packages (+6 Dependent packages)

Total download size: 103 M
Installed size: 425 M
Is this ok [y/d/N]: y
Downloading packages:
(1/9): container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm                                                                                                                      |  40 kB  00:00:00
warning: /var/cache/yum/x86_64/7Server/docker-ce-stable/packages/docker-ce-20.10.5-3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY           ] 5.4 MB/s |  29 MB  00:00:13 ETA
Public key for docker-ce-20.10.5-3.el7.x86_64.rpm is not installed
(2/9): docker-ce-20.10.5-3.el7.x86_64.rpm                                                                                                                                        |  27 MB  00:00:03
(3/9): docker-ce-cli-20.10.5-3.el7.x86_64.rpm                                                                                                                                    |  33 MB  00:00:03
(4/9): fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm                                                                                                                                   |  55 kB  00:00:00
(5/9): libseccomp-2.3.1-4.el7.x86_64.rpm                                                                                                                                         |  56 kB  00:00:00
(6/9): slirp4netns-0.4.3-4.el7_8.x86_64.rpm                                                                                                                                      |  82 kB  00:00:00
(7/9): fuse3-libs-3.6.1-4.el7.x86_64.rpm                                                                                                                                         |  82 kB  00:00:00
(8/9): docker-ce-rootless-extras-20.10.5-3.el7.x86_64.rpm                                                                                                                        | 9.1 MB  00:00:02
(9/9): containerd.io-1.4.4-3.1.el7.x86_64.rpm                                                                                                                                    |  33 MB  00:00:10
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                   9.5 MB/s | 103 MB  00:00:10
Retrieving key from https://download.docker.com/linux/centos/gpg
Importing GPG key 0x621E9F35:
 Userid     : "Docker Release (CE rpm) <docker@docker.com>"
 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
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libseccomp-2.3.1-4.el7.x86_64                                                                                                                                                        1/9
  Installing : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch                                                                                                                                   2/9
  Installing : containerd.io-1.4.4-3.1.el7.x86_64                                                                                                                                                   3/9
  Installing : slirp4netns-0.4.3-4.el7_8.x86_64                                                                                                                                                     4/9
  Installing : fuse3-libs-3.6.1-4.el7.x86_64                                                                                                                                                        5/9
  Installing : fuse-overlayfs-0.7.2-6.el7_8.x86_64                                                                                                                                                  6/9
  Installing : 1:docker-ce-cli-20.10.5-3.el7.x86_64                                                                                                                                                 7/9
  Installing : docker-ce-rootless-extras-20.10.5-3.el7.x86_64                                                                                                                                       8/9
  Installing : 3:docker-ce-20.10.5-3.el7.x86_64                                                                                                                                                     9/9
  Verifying  : 1:docker-ce-cli-20.10.5-3.el7.x86_64                                                                                                                                                 1/9
  Verifying  : fuse3-libs-3.6.1-4.el7.x86_64                                                                                                                                                        2/9
  Verifying  : fuse-overlayfs-0.7.2-6.el7_8.x86_64                                                                                                                                                  3/9
  Verifying  : slirp4netns-0.4.3-4.el7_8.x86_64                                                                                                                                                     4/9
  Verifying  : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch                                                                                                                                   5/9
  Verifying  : libseccomp-2.3.1-4.el7.x86_64                                                                                                                                                        6/9
  Verifying  : 3:docker-ce-20.10.5-3.el7.x86_64                                                                                                                                                     7/9
  Verifying  : docker-ce-rootless-extras-20.10.5-3.el7.x86_64                                                                                                                                       8/9
  Verifying  : containerd.io-1.4.4-3.1.el7.x86_64                                                                                                                                                   9/9
rhel-7-server-extras-rpms/x86_64/productid                                                                                                                                       | 2.1 kB  00:00:00

Installed:
  containerd.io.x86_64 0:1.4.4-3.1.el7                               docker-ce.x86_64 3:20.10.5-3.el7                               docker-ce-cli.x86_64 1:20.10.5-3.el7

Dependency Installed:
  container-selinux.noarch 2:2.119.2-1.911c772.el7_8        docker-ce-rootless-extras.x86_64 0:20.10.5-3.el7        fuse-overlayfs.x86_64 0:0.7.2-6.el7_8        fuse3-libs.x86_64 0:3.6.1-4.el7
  libseccomp.x86_64 0:2.3.1-4.el7                           slirp4netns.x86_64 0:0.4.3-4.el7_8

Complete!
[root@anaconda ~]#
```

Docker 起動と確認は以下で行います。

```bash:コマンド
sudo systemctl start docker
sudo systemctl status docker
```
```console:結果
[root@anaconda ~]# sudo systemctl start docker
[root@anaconda ~]# sudo systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2021-03-15 00:11:56 CDT; 17s ago
     Docs: https://docs.docker.com
 Main PID: 100959 (dockerd)
    Tasks: 12
   Memory: 45.0M
   CGroup: /system.slice/docker.service
           mq100959 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Mar 15 00:11:55 anaconda.icp4djp.cloud dockerd[100959]: time="2021-03-15T00:11:55.083660538-05:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Mar 15 00:11:55 anaconda.icp4djp.cloud dockerd[100959]: time="2021-03-15T00:11:55.083720390-05:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/con... module=grpc
Mar 15 00:11:55 anaconda.icp4djp.cloud dockerd[100959]: time="2021-03-15T00:11:55.083783691-05:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Mar 15 00:11:55 anaconda.icp4djp.cloud dockerd[100959]: time="2021-03-15T00:11:55.235180629-05:00" level=info msg="Loading containers: start."
Mar 15 00:11:55 anaconda.icp4djp.cloud dockerd[100959]: time="2021-03-15T00:11:55.987153728-05:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16.... IP address"
Mar 15 00:11:56 anaconda.icp4djp.cloud dockerd[100959]: time="2021-03-15T00:11:56.153072279-05:00" level=info msg="Loading containers: done."
Mar 15 00:11:56 anaconda.icp4djp.cloud dockerd[100959]: time="2021-03-15T00:11:56.237055528-05:00" level=info msg="Docker daemon" commit=363e9a8 graphdriver(s)=overlay2 version=20.10.5
Mar 15 00:11:56 anaconda.icp4djp.cloud dockerd[100959]: time="2021-03-15T00:11:56.237429530-05:00" level=info msg="Daemon has completed initialization"
Mar 15 00:11:56 anaconda.icp4djp.cloud systemd[1]: Started Docker Application Container Engine.
Mar 15 00:11:56 anaconda.icp4djp.cloud dockerd[100959]: time="2021-03-15T00:11:56.340275867-05:00" level=info msg="API listen on /var/run/docker.sock"
Hint: Some lines were ellipsized, use -l to show in full.
[root@anaconda ~]#
```

## テスト実行

hello-worldでテストを実行します。

```bash:コマンド
sudo docker run hello-world
```
```console:結果
[root@anaconda ~]# sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete
Digest: sha256:308866a43596e83578c7dfa15e27a73011bdd402185a84c5cd7f32a88b501a24
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

[root@anaconda ~]#
```

hello worldのコンテナを削除します。

```bash:コマンド
docker ps -a
docker rm <コンテナID>
```
```console:結果
[root@anaconda ~]# docker ps -a
CONTAINER ID   IMAGE         COMMAND    CREATED       STATUS                   PORTS     NAMES
0d83c3fa749c   hello-world   "/hello"   2 hours ago   Exited (0) 2 hours ago             pensive_spence
[root@anaconda ~]# docker rm 0d83c3fa749c
0d83c3fa749c
[root@anaconda ~]# docker ps -a
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
[root@anaconda ~]#
```

hello worldのイメージを削除します。

```bash:コマンド
docker images
docker rmi
```
```console:結果
[root@anaconda ~]# docker images
REPOSITORY    TAG       IMAGE ID       CREATED      SIZE
hello-world   latest    d1165f221234   9 days ago   13.3kB
[root@anaconda ~]# docker rmi d1165f221234
Untagged: hello-world:latest
Untagged: hello-world@sha256:308866a43596e83578c7dfa15e27a73011bdd402185a84c5cd7f32a88b501a24
Deleted: sha256:d1165f2212346b2bab48cb01c1e39ee8ad1be46b87873d9ca7a4e434980a7726
Deleted: sha256:f22b99068db93900abe17f7f5e09ec775c2826ecfe9db961fea68293744144bd
[root@anaconda ~]# docker images
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE
[root@anaconda ~]#
```

## Docker をブート時に自動起動する
DockerをOSブート時に起動する場合には以下で設定が可能です。

```bash:コマンド
sudo systemctl enable docker
```
```console:結果
[root@anaconda ~]# sudo systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
```

＜参考＞systemd で Docker の管理・設定 — Docker-docs-ja 1.11.0 ドキュメント <BR>
http://docs.docker.jp/v1.11/engine/admin/systemd.html

## 参考情報
なお、RHELの中にもDockerは含まれていますが古く、かつ少し新しいバージョンだったdocker-latestはRHEL7.5 から非推奨だということです。

https://access.redhat.com/articles/2317361

Docker Enterprise EditionはRHELを明示的にサポートしていそうですが、2021/3月現在はDocker社からMirantis社に売却されたそうで、情報が見つけられませんでした。


https://www.publickey1.jp/blog/17/dockerdockerdocker_enterprise_editioncommunity_edition.html

https://www.publickey1.jp/blog/20/dockerdocker_enterprisemirantisdocker_enterprise_31.html