1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Azure VM(RHEL 8.x)へDockerをインストール

Posted at

手順メモ

Azure VM(RHEL 8.x)へDockerをインストールする機会があり、少しはまったため備忘。
(AWSでは、すんなりインストール可能)
まずはドキュメント通りに進めてみる。DockerはRHELをサポートしていないため、CentOSの手順を参照。

[azureuser@vm01 ~]$ sudo yum install -y yum-utils
Red Hat Enterprise Linux 8 for x86_64 - BaseOS - Extended Update Support from RHUI (RPMs)            12 MB/s |  29 MB     00:02    
Red Hat Enterprise Linux 8 for x86_64 - AppStream - Extended Update Support from RHUI (RPMs)        6.8 MB/s |  17 MB     00:02    
Microsoft Azure RPMs for RHEL8 Extended Update Support                                              2.4 kB/s | 2.2 kB     00:00    
Package yum-utils-4.0.8-4.el8_1.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[azureuser@vm01 ~]$ sudo yum-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
[azureuser@vm01 ~]$ sudo yum install docker-ce docker-ce-cli containerd.io
Docker CE Stable - x86_64                                                                            52 kB/s |  23 kB     00:00    
Red Hat Enterprise Linux 8 for x86_64 - BaseOS - Extended Update Support from RHUI (RPMs)           4.3 kB/s | 2.4 kB     00:00    
Red Hat Enterprise Linux 8 for x86_64 - AppStream - Extended Update Support from RHUI (RPMs)        4.9 kB/s | 2.8 kB     00:00    
Microsoft Azure RPMs for RHEL8 Extended Update Support                                              6.6 kB/s | 2.1 kB     00:00    
Error: 
 Problem: package docker-ce-3:20.10.14-3.el8.x86_64 requires docker-ce-rootless-extras, but none of the providers can be installed
  - cannot install the best candidate for the job
  - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.0-3.el8.x86_64
  - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.0-3.el8.x86_64
  - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.1-3.el8.x86_64
  - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.1-3.el8.x86_64
  - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.10-3.el8.x86_64
  - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.10-3.el8.x86_64
  - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.11-3.el8.x86_64
  - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.11-3.el8.x86_64
  - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.12-3.el8.x86_64
  - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.12-3.el8.x86_64
  - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.13-3.el8.x86_64
  - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.13-3.el8.x86_64
  - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.14-3.el8.x86_64
  - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.14-3.el8.x86_64
  - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.2-3.el8.x86_64
  - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.2-3.el8.x86_64
  - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.3-3.el8.x86_64
  - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.3-3.el8.x86_64
  - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.4-3.el8.x86_64
  - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.4-3.el8.x86_64
  - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.5-3.el8.x86_64
  - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.5-3.el8.x86_64
  - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.6-3.el8.x86_64
  - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.6-3.el8.x86_64
  - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.7-3.el8.x86_64
  - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.7-3.el8.x86_64
  - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.8-3.el8.x86_64
  - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.8-3.el8.x86_64
  - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.9-3.el8.x86_64
  - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.9-3.el8.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
[azureuser@vm01 ~]$ 

エラーとなる。「fuse-overlayfs」「slirp4netns」の利用可能バージョンを確認する。

[azureuser@vm01 ~]$ sudo yum info fuse-overlayfs slirp4netns
Last metadata expiration check: 0:00:00 ago on xx xx Apr 2022 0:00:00 AM UTC.
Available Packages
Name         : fuse-overlayfs
Version      : 0.4.1
Release      : 1.module+el8.1.0+4081+b29780af
Architecture : x86_64
Size         : 50 k
Source       : fuse-overlayfs-0.4.1-1.module+el8.1.0+4081+b29780af.src.rpm
Repository   : rhel-8-for-x86_64-appstream-eus-rhui-rpms
Summary      : FUSE overlay+shiftfs implementation for rootless containers
URL          : https://github.com/containers/fuse-overlayfs
License      : GPLv3+
Description  : FUSE overlay+shiftfs implementation for rootless containers.

Name         : slirp4netns
Version      : 0.3.0
Release      : 4.module+el8.1.0+4306+1d917805
Architecture : x86_64
Size         : 83 k
Source       : slirp4netns-0.3.0-4.module+el8.1.0+4306+1d917805.src.rpm
Repository   : rhel-8-for-x86_64-appstream-eus-rhui-rpms
Summary      : slirp for network namespaces
URL          : https://github.com/rootless-containers/slirp4netns
License      : GPLv2
Description  : User-mode networking for unprivileged network namespaces.

[azureuser@vm01 ~]$ 

fuse-overlayfs:0.4.1、slirp4netns:0.3.0が利用可能であることが分かる。
「docker-ce」で利用する「docker-ce-rootless-extras」をインストールするためには、「fuse-overlayfs >= 0.7」「slirp4netns >= 0.4」が必要となるが、それを満たさないためエラーとなる模様。

dockerのインストール可能なバージョンを確認。

[azureuser@vm01 ~]$ sudo yum --showduplicates list | grep docker-ce.x86_64
docker-ce.x86_64                                     3:19.03.13-3.el8                                           docker-ce-stable                           
docker-ce.x86_64                                     3:19.03.14-3.el8                                           docker-ce-stable                           
docker-ce.x86_64                                     3:19.03.15-3.el8                                           docker-ce-stable                           
docker-ce.x86_64                                     3:20.10.0-3.el8                                            docker-ce-stable                           
docker-ce.x86_64                                     3:20.10.1-3.el8                                            docker-ce-stable                           
docker-ce.x86_64                                     3:20.10.2-3.el8                                            docker-ce-stable                           
docker-ce.x86_64                                     3:20.10.3-3.el8                                            docker-ce-stable                           
docker-ce.x86_64                                     3:20.10.4-3.el8                                            docker-ce-stable                           
docker-ce.x86_64                                     3:20.10.5-3.el8                                            docker-ce-stable                           
docker-ce.x86_64                                     3:20.10.6-3.el8                                            docker-ce-stable                           
docker-ce.x86_64                                     3:20.10.7-3.el8                                            docker-ce-stable                           
docker-ce.x86_64                                     3:20.10.8-3.el8                                            docker-ce-stable                           
docker-ce.x86_64                                     3:20.10.9-3.el8                                            docker-ce-stable                           
docker-ce.x86_64                                     3:20.10.10-3.el8                                           docker-ce-stable                           
docker-ce.x86_64                                     3:20.10.11-3.el8                                           docker-ce-stable                           
docker-ce.x86_64                                     3:20.10.12-3.el8                                           docker-ce-stable                           
docker-ce.x86_64                                     3:20.10.13-3.el8                                           docker-ce-stable                           
docker-ce.x86_64                                     3:20.10.14-3.el8                                           docker-ce-stable                           
[azureuser@vm01 ~]$ 

古いバージョンのdockerを指定してインストール。 ※docker-ce-3:20.xは全て同エラーとなることは確認済。

[azureuser@vm01 ~]$ sudo yum install docker-ce-3:19.03.15-3.el8 \
>  docker-ce-cli containerd.io
Last metadata expiration check: 0:00:00 ago on xx xx Apr 2022 0:00:00 AM UTC.
Dependencies resolved.
====================================================================================================================================
 Package                Arch       Version                                      Repository                                     Size
====================================================================================================================================
Installing:
 containerd.io          x86_64     1.5.11-3.1.el8                               docker-ce-stable                               29 M
 docker-ce              x86_64     3:19.03.15-3.el8                             docker-ce-stable                               24 M
 docker-ce-cli          x86_64     1:20.10.14-3.el8                             docker-ce-stable                               30 M
Installing dependencies:
 docker-scan-plugin     x86_64     0.17.0-3.el8                                 docker-ce-stable                              3.8 M
 libcgroup              x86_64     0.41-19.el8                                  rhel-8-for-x86_64-baseos-eus-rhui-rpms         70 k
 container-selinux      noarch     2:2.123.0-2.module+el8.1.0+4900+9d7326b8     rhel-8-for-x86_64-appstream-eus-rhui-rpms      45 k
Enabling module streams:
 container-tools                   rhel8                                                                                           

Transaction Summary
====================================================================================================================================
Install  6 Packages

Total download size: 87 M
Installed size: 368 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): containerd.io-1.5.11-3.1.el8.x86_64.rpm                                                       49 MB/s |  29 MB     00:00    
(2/6): docker-ce-19.03.15-3.el8.x86_64.rpm                                                           33 MB/s |  24 MB     00:00    
(3/6): docker-scan-plugin-0.17.0-3.el8.x86_64.rpm                                                    16 MB/s | 3.8 MB     00:00    
(4/6): docker-ce-cli-20.10.14-3.el8.x86_64.rpm                                                       32 MB/s |  30 MB     00:00    
(5/6): libcgroup-0.41-19.el8.x86_64.rpm                                                             101 kB/s |  70 kB     00:00    
(6/6): container-selinux-2.123.0-2.module+el8.1.0+4900+9d7326b8.noarch.rpm                           66 kB/s |  45 kB     00:00    
------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                57 MB/s |  87 MB     00:01     
warning: /var/cache/dnf/docker-ce-stable-bbb88d8c1c4d66b5/packages/containerd.io-1.5.11-3.1.el8.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Docker CE Stable - x86_64                                                                            50 kB/s | 1.6 kB     00:00    
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
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                            1/1 
  Installing       : docker-scan-plugin-0.17.0-3.el8.x86_64                                                                     1/6 
  Running scriptlet: docker-scan-plugin-0.17.0-3.el8.x86_64                                                                     1/6 
  Installing       : docker-ce-cli-1:20.10.14-3.el8.x86_64                                                                      2/6 
  Running scriptlet: docker-ce-cli-1:20.10.14-3.el8.x86_64                                                                      2/6 
  Installing       : container-selinux-2:2.123.0-2.module+el8.1.0+4900+9d7326b8.noarch                                          3/6 
  Running scriptlet: container-selinux-2:2.123.0-2.module+el8.1.0+4900+9d7326b8.noarch                                          3/6 
  Installing       : containerd.io-1.5.11-3.1.el8.x86_64                                                                        4/6 
  Running scriptlet: containerd.io-1.5.11-3.1.el8.x86_64                                                                        4/6 
  Running scriptlet: libcgroup-0.41-19.el8.x86_64                                                                               5/6 
  Installing       : libcgroup-0.41-19.el8.x86_64                                                                               5/6 
  Running scriptlet: libcgroup-0.41-19.el8.x86_64                                                                               5/6 
  Installing       : docker-ce-3:19.03.15-3.el8.x86_64                                                                          6/6 
  Running scriptlet: docker-ce-3:19.03.15-3.el8.x86_64                                                                          6/6 
  Verifying        : containerd.io-1.5.11-3.1.el8.x86_64                                                                        1/6 
  Verifying        : docker-ce-3:19.03.15-3.el8.x86_64                                                                          2/6 
  Verifying        : docker-ce-cli-1:20.10.14-3.el8.x86_64                                                                      3/6 
  Verifying        : docker-scan-plugin-0.17.0-3.el8.x86_64                                                                     4/6 
  Verifying        : libcgroup-0.41-19.el8.x86_64                                                                               5/6 
  Verifying        : container-selinux-2:2.123.0-2.module+el8.1.0+4900+9d7326b8.noarch                                          6/6 
Installed products updated.

Installed:
  containerd.io-1.5.11-3.1.el8.x86_64                docker-ce-3:19.03.15-3.el8.x86_64                                             
  docker-ce-cli-1:20.10.14-3.el8.x86_64              docker-scan-plugin-0.17.0-3.el8.x86_64                                        
  libcgroup-0.41-19.el8.x86_64                       container-selinux-2:2.123.0-2.module+el8.1.0+4900+9d7326b8.noarch             

Complete!
[azureuser@vm01 ~]$ 

エラー無しでインストール完了。動作確認。

[azureuser@vm01 ~]$ sudo systemctl start docker
[azureuser@vm01 ~]$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete 
Digest: sha256:bfea6278a0a267fad2634554f4f0c6f31981eea41c553fdf5a83e95a41d40c38
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/

[azureuser@vm01 ~]$ 

とりあえずは動作したが、はたしてこれが正解なのだろうか。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?