CKA 試験準備テスト | Docker のインストールと構成

書籍出典: 『CKA/CKAD テストガイド: Docker から Kubernetes 完全攻略まで』

学習中に先生の授業内容やテストノートを整理してみんなで共有してください。違反しているものは削除されます。よろしくお願いします。

概要の投稿を添付します: CKA 試験準備テスト | 概要


コンテナやイメージを管理するには、システムにランタイム(ランタイム)をインストールする必要があります。いわゆるランタイムとは、コンテナを管理するもので、Dockerもランタイムであり、containerdもランタイムです。ここでは主に docker の使用について説明するため、最初に docker-ce をインストールする必要があります。

docker-ceをインストールする

この演習は vms100 で動作します。

ステップ 1: yum ソースを構成します。

##########实操验证##########
[root@vms100 ~]# rm -rf /etc/yum.repos.d/* ; wget -P /etc/yum.repos.d ftp://ftp.rhce.cc/k8s/*
--2023-05-02 23:07:22--  ftp://ftp.rhce.cc/k8s/*
           => ‘/etc/yum.repos.d/.listing’
Resolving ftp.rhce.cc (ftp.rhce.cc)... 101.37.152.41, 101.37.152.41
Connecting to ftp.rhce.cc (ftp.rhce.cc)|101.37.152.41|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD (1) /k8s ... done.
==> PASV ... done.    ==> LIST ... done.

    [ <=>                                                                                                                                   ] 544         --.-K/s   in 0s      

2023-05-02 23:07:22 (60.7 MB/s) - ‘/etc/yum.repos.d/.listing’ saved [544]

Removed ‘/etc/yum.repos.d/.listing’.
--2023-05-02 23:07:22--  ftp://ftp.rhce.cc/k8s/CentOS-Base.repo
           => ‘/etc/yum.repos.d/CentOS-Base.repo’
==> CWD not required.
==> PASV ... done.    ==> RETR CentOS-Base.repo ... done.
Length: 2206 (2.2K)

100%[======================================================================================================================================>] 2,206       --.-K/s   in 0s      

2023-05-02 23:07:22 (5.16 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2206]

--2023-05-02 23:07:22--  ftp://ftp.rhce.cc/k8s/docker-ce.repo
           => ‘/etc/yum.repos.d/docker-ce.repo’
==> CWD not required.
==> PASV ... done.    ==> RETR docker-ce.repo ... done.
Length: 234

100%[======================================================================================================================================>] 234         --.-K/s   in 0.001s  

2023-05-02 23:07:23 (394 KB/s) - ‘/etc/yum.repos.d/docker-ce.repo’ saved [234]

--2023-05-02 23:07:23--  ftp://ftp.rhce.cc/k8s/docker-ce.repo.bak
           => ‘/etc/yum.repos.d/docker-ce.repo.bak’
==> CWD not required.
==> PASV ... done.    ==> RETR docker-ce.repo.bak ... done.
Length: 2640 (2.6K)

100%[======================================================================================================================================>] 2,640       --.-K/s   in 0s      

2023-05-02 23:07:23 (120 MB/s) - ‘/etc/yum.repos.d/docker-ce.repo.bak’ saved [2640]

--2023-05-02 23:07:23--  ftp://ftp.rhce.cc/k8s/epel.repo
           => ‘/etc/yum.repos.d/epel.repo’
==> CWD not required.
==> PASV ... done.    ==> RETR epel.repo ... done.
Length: 923

100%[======================================================================================================================================>] 923         --.-K/s   in 0s      

2023-05-02 23:07:23 (52.1 MB/s) - ‘/etc/yum.repos.d/epel.repo’ saved [923]

--2023-05-02 23:07:23--  ftp://ftp.rhce.cc/k8s/k8s.repo
           => ‘/etc/yum.repos.d/k8s.repo’
==> CWD not required.
==> PASV ... done.    ==> RETR k8s.repo ... done.
Length: 139

100%[======================================================================================================================================>] 139         --.-K/s   in 0s      

2023-05-02 23:07:23 (16.6 MB/s) - ‘/etc/yum.repos.d/k8s.repo’ saved [139]

--2023-05-02 23:07:23--  ftp://ftp.rhce.cc/k8s/k8s.repo.bak
           => ‘/etc/yum.repos.d/k8s.repo.bak’
==> CWD not required.
==> PASV ... done.    ==> RETR k8s.repo.bak ... done.
Length: 276

100%[======================================================================================================================================>] 276         --.-K/s   in 0s      

2023-05-02 23:07:23 (22.7 MB/s) - ‘/etc/yum.repos.d/k8s.repo.bak’ saved [276]

[root@vms100 ~]#

ステップ 2: Docker をインストールします。

##########实操验证##########
[root@vms100 ~]# yum install docker-ce -y
Loaded plugins: fastestmirror, langpacks
base                                                                                                                                                                           | 3.6 kB  00:00:00     
docker-ce                                                                                                                                                                      | 3.5 kB  00:00:00     
epel                                                                                                                                                                           | 4.7 kB  00:00:00     
extras                                                                                                                                                                         | 2.9 kB  00:00:00     
kubernetes                                                                                                                                                                     | 2.9 kB  00:00:00     
updates                                                                                                                                                                        | 2.9 kB  00:00:00     
(1/7): docker-ce/7/x86_64/updateinfo                                                                                                                                           |   55 B  00:00:00     
(2/7): epel/x86_64/group_gz                                                                                                                                                    |  99 kB  00:00:00     
(3/7): epel/x86_64/updateinfo                                                                                                                                                  | 1.0 MB  00:00:00     
(4/7): docker-ce/7/x86_64/primary_db                                                                                                                                           | 106 kB  00:00:00     
(5/7): base/7/x86_64/primary_db                                                                                                                                                | 6.1 MB  00:00:00     
(6/7): kubernetes/primary_db                                                                                                                                                   | 236 kB  00:00:00     
(7/7): epel/x86_64/primary_db                                                                                                                                                  | 7.0 MB  00:00:00     
Determining fastest mirrors
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 3:23.0.5-1.el7 will be installed
--> Processing Dependency: container-selinux >= 2:2.74 for package: 3:docker-ce-23.0.5-1.el7.x86_64
--> Processing Dependency: containerd.io >= 1.6.4 for package: 3:docker-ce-23.0.5-1.el7.x86_64
--> Processing Dependency: docker-ce-cli for package: 3:docker-ce-23.0.5-1.el7.x86_64
--> Processing Dependency: docker-ce-rootless-extras for package: 3:docker-ce-23.0.5-1.el7.x86_64
--> Running transaction check
---> Package container-selinux.noarch 2:2.119.2-1.911c772.el7_8 will be installed
--> Processing Dependency: selinux-policy-targeted >= 3.13.1-216.el7 for package: 2:container-selinux-2.119.2-1.911c772.el7_8.noarch
--> Processing Dependency: selinux-policy-base >= 3.13.1-216.el7 for package: 2:container-selinux-2.119.2-1.911c772.el7_8.noarch
--> Processing Dependency: selinux-policy >= 3.13.1-216.el7 for package: 2:container-selinux-2.119.2-1.911c772.el7_8.noarch
---> Package containerd.io.x86_64 0:1.6.20-3.1.el7 will be installed
---> Package docker-ce-cli.x86_64 1:23.0.5-1.el7 will be installed
--> Processing Dependency: docker-buildx-plugin for package: 1:docker-ce-cli-23.0.5-1.el7.x86_64
--> Processing Dependency: docker-compose-plugin for package: 1:docker-ce-cli-23.0.5-1.el7.x86_64
---> Package docker-ce-rootless-extras.x86_64 0:23.0.5-1.el7 will be installed
--> Processing Dependency: fuse-overlayfs >= 0.7 for package: docker-ce-rootless-extras-23.0.5-1.el7.x86_64
--> Processing Dependency: slirp4netns >= 0.4 for package: docker-ce-rootless-extras-23.0.5-1.el7.x86_64
--> Running transaction check
---> Package docker-buildx-plugin.x86_64 0:0.10.4-1.el7 will be installed
---> Package docker-compose-plugin.x86_64 0:2.17.3-1.el7 will be installed
---> 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 selinux-policy.noarch 0:3.13.1-166.el7 will be updated
---> Package selinux-policy.noarch 0:3.13.1-268.el7_9.2 will be an update
--> Processing Dependency: policycoreutils >= 2.5-24 for package: selinux-policy-3.13.1-268.el7_9.2.noarch
--> Processing Dependency: libsemanage >= 2.5-13 for package: selinux-policy-3.13.1-268.el7_9.2.noarch
---> Package selinux-policy-targeted.noarch 0:3.13.1-166.el7 will be updated
---> Package selinux-policy-targeted.noarch 0:3.13.1-268.el7_9.2 will be an update
---> 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
---> Package libsemanage.x86_64 0:2.5-8.el7 will be updated
--> Processing Dependency: libsemanage = 2.5-8.el7 for package: libsemanage-python-2.5-8.el7.x86_64
---> Package libsemanage.x86_64 0:2.5-14.el7 will be an update
--> Processing Dependency: libsepol >= 2.5-10 for package: libsemanage-2.5-14.el7.x86_64
--> Processing Dependency: libselinux >= 2.5-14 for package: libsemanage-2.5-14.el7.x86_64
---> Package policycoreutils.x86_64 0:2.5-17.1.el7 will be updated
--> Processing Dependency: policycoreutils = 2.5-17.1.el7 for package: policycoreutils-python-2.5-17.1.el7.x86_64
---> Package policycoreutils.x86_64 0:2.5-34.el7 will be an update
--> Processing Dependency: libselinux-utils >= 2.5-14 for package: policycoreutils-2.5-34.el7.x86_64
--> Running transaction check
---> Package libselinux.x86_64 0:2.5-11.el7 will be updated
--> Processing Dependency: libselinux(x86-64) = 2.5-11.el7 for package: libselinux-python-2.5-11.el7.x86_64
---> Package libselinux.x86_64 0:2.5-15.el7 will be an update
---> Package libselinux-utils.x86_64 0:2.5-11.el7 will be updated
---> Package libselinux-utils.x86_64 0:2.5-15.el7 will be an update
---> Package libsemanage-python.x86_64 0:2.5-8.el7 will be updated
---> Package libsemanage-python.x86_64 0:2.5-14.el7 will be an update
---> Package libsepol.x86_64 0:2.5-6.el7 will be updated
---> Package libsepol.x86_64 0:2.5-10.el7 will be an update
---> Package policycoreutils-python.x86_64 0:2.5-17.1.el7 will be updated
---> Package policycoreutils-python.x86_64 0:2.5-34.el7 will be an update
--> Processing Dependency: setools-libs >= 3.3.8-4 for package: policycoreutils-python-2.5-34.el7.x86_64
--> Running transaction check
---> Package libselinux-python.x86_64 0:2.5-11.el7 will be updated
---> Package libselinux-python.x86_64 0:2.5-15.el7 will be an update
---> Package setools-libs.x86_64 0:3.3.8-1.1.el7 will be updated
---> Package setools-libs.x86_64 0:3.3.8-4.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================================================================
 Package                                                 Arch                                 Version                                                   Repository                               Size
======================================================================================================================================================================================================
Installing:
 docker-ce                                               x86_64                               3:23.0.5-1.el7                                            docker-ce                                23 M
Installing for dependencies:
 container-selinux                                       noarch                               2:2.119.2-1.911c772.el7_8                                 extras                                   40 k
 containerd.io                                           x86_64                               1.6.20-3.1.el7                                            docker-ce                                34 M
 docker-buildx-plugin                                    x86_64                               0.10.4-1.el7                                              docker-ce                                12 M
 docker-ce-cli                                           x86_64                               1:23.0.5-1.el7                                            docker-ce                                13 M
 docker-ce-rootless-extras                               x86_64                               23.0.5-1.el7                                              docker-ce                               8.8 M
 docker-compose-plugin                                   x86_64                               2.17.3-1.el7                                              docker-ce                                12 M
 fuse-overlayfs                                          x86_64                               0.7.2-6.el7_8                                             extras                                   54 k
 fuse3-libs                                              x86_64                               3.6.1-4.el7                                               extras                                   82 k
 slirp4netns                                             x86_64                               0.4.3-4.el7_8                                             extras                                   81 k
Updating for dependencies:
 libselinux                                              x86_64                               2.5-15.el7                                                base                                    162 k
 libselinux-python                                       x86_64                               2.5-15.el7                                                base                                    236 k
 libselinux-utils                                        x86_64                               2.5-15.el7                                                base                                    151 k
 libsemanage                                             x86_64                               2.5-14.el7                                                base                                    151 k
 libsemanage-python                                      x86_64                               2.5-14.el7                                                base                                    113 k
 libsepol                                                x86_64                               2.5-10.el7                                                base                                    297 k
 policycoreutils                                         x86_64                               2.5-34.el7                                                base                                    917 k
 policycoreutils-python                                  x86_64                               2.5-34.el7                                                base                                    457 k
 selinux-policy                                          noarch                               3.13.1-268.el7_9.2                                        updates                                 498 k
 selinux-policy-targeted                                 noarch                               3.13.1-268.el7_9.2                                        updates                                 7.0 M
 setools-libs                                            x86_64                               3.3.8-4.el7                                               base                                    620 k

Transaction Summary
======================================================================================================================================================================================================
Install  1 Package  (+ 9 Dependent packages)
Upgrade             ( 11 Dependent packages)

Total download size: 114 M
Downloading packages:
No Presto metadata available for base
No Presto metadata available for updates
warning: /var/cache/yum/x86_64/7/extras/packages/container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm is not installed
(1/21): container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm                                                                                                                   |  40 kB  00:00:00     
(2/21): docker-buildx-plugin-0.10.4-1.el7.x86_64.rpm                                                                                                                           |  12 MB  00:00:02     
(3/21): docker-ce-23.0.5-1.el7.x86_64.rpm                                                                                                                                      |  23 MB  00:00:04     
(4/21): containerd.io-1.6.20-3.1.el7.x86_64.rpm                                                                                                                                |  34 MB  00:00:08     
(5/21): docker-ce-cli-23.0.5-1.el7.x86_64.rpm                                                                                                                                  |  13 MB  00:00:02     
(6/21): fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm                                                                                                                                |  54 kB  00:00:00     
Public key for libselinux-python-2.5-15.el7.x86_64.rpm is not installed
(7/21): libselinux-python-2.5-15.el7.x86_64.rpm                                                                                                                                | 236 kB  00:00:00     
(8/21): libselinux-utils-2.5-15.el7.x86_64.rpm                                                                                                                                 | 151 kB  00:00:00     
(9/21): fuse3-libs-3.6.1-4.el7.x86_64.rpm                                                                                                                                      |  82 kB  00:00:00     
(10/21): libsemanage-2.5-14.el7.x86_64.rpm                                                                                                                                     | 151 kB  00:00:00     
(11/21): libsemanage-python-2.5-14.el7.x86_64.rpm                                                                                                                              | 113 kB  00:00:00     
(12/21): libselinux-2.5-15.el7.x86_64.rpm                                                                                                                                      | 162 kB  00:00:00     
(13/21): libsepol-2.5-10.el7.x86_64.rpm                                                                                                                                        | 297 kB  00:00:00     
(14/21): docker-ce-rootless-extras-23.0.5-1.el7.x86_64.rpm                                                                                                                     | 8.8 MB  00:00:02     
(15/21): policycoreutils-python-2.5-34.el7.x86_64.rpm                                                                                                                          | 457 kB  00:00:00     
(16/21): policycoreutils-2.5-34.el7.x86_64.rpm                                                                                                                                 | 917 kB  00:00:00     
(17/21): setools-libs-3.3.8-4.el7.x86_64.rpm                                                                                                                                   | 620 kB  00:00:00     
(18/21): slirp4netns-0.4.3-4.el7_8.x86_64.rpm                                                                                                                                  |  81 kB  00:00:00     
Public key for selinux-policy-3.13.1-268.el7_9.2.noarch.rpm is not installed         87% [================================================================          ] 8.4 MB/s |  99 MB  00:00:01 ETA 
(19/21): selinux-policy-3.13.1-268.el7_9.2.noarch.rpm                                                                                                                          | 498 kB  00:00:00     
(20/21): docker-compose-plugin-2.17.3-1.el7.x86_64.rpm                                                                                                                         |  12 MB  00:00:02     
(21/21): selinux-policy-targeted-3.13.1-268.el7_9.2.noarch.rpm                                                                                                                 | 7.0 MB  00:00:01     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                 9.3 MB/s | 114 MB  00:00:12     
Retrieving key from http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <[email protected]>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 From       : http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : libsepol-2.5-10.el7.x86_64                                                                                                                                                        1/32 
  Updating   : libselinux-2.5-15.el7.x86_64                                                                                                                                                      2/32 
  Updating   : libsemanage-2.5-14.el7.x86_64                                                                                                                                                     3/32 
  Updating   : libselinux-utils-2.5-15.el7.x86_64                                                                                                                                                4/32 
  Updating   : policycoreutils-2.5-34.el7.x86_64                                                                                                                                                 5/32 
  Updating   : selinux-policy-3.13.1-268.el7_9.2.noarch                                                                                                                                          6/32 
  Updating   : selinux-policy-targeted-3.13.1-268.el7_9.2.noarch                                                                                                                                 7/32 
  Updating   : libsemanage-python-2.5-14.el7.x86_64                                                                                                                                              8/32 
  Updating   : libselinux-python-2.5-15.el7.x86_64                                                                                                                                               9/32 
  Updating   : setools-libs-3.3.8-4.el7.x86_64                                                                                                                                                  10/32 
  Updating   : policycoreutils-python-2.5-34.el7.x86_64                                                                                                                                         11/32 
  Installing : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch                                                                                                                               12/32 
setsebool:  SELinux is disabled.
  Installing : containerd.io-1.6.20-3.1.el7.x86_64                                                                                                                                              13/32 
  Installing : docker-compose-plugin-2.17.3-1.el7.x86_64                                                                                                                                        14/32 
  Installing : slirp4netns-0.4.3-4.el7_8.x86_64                                                                                                                                                 15/32 
  Installing : fuse3-libs-3.6.1-4.el7.x86_64                                                                                                                                                    16/32 
  Installing : fuse-overlayfs-0.7.2-6.el7_8.x86_64                                                                                                                                              17/32 
  Installing : docker-buildx-plugin-0.10.4-1.el7.x86_64                                                                                                                                         18/32 
  Installing : 1:docker-ce-cli-23.0.5-1.el7.x86_64                                                                                                                                              19/32 
  Installing : 3:docker-ce-23.0.5-1.el7.x86_64                                                                                                                                                  20/32 
  Installing : docker-ce-rootless-extras-23.0.5-1.el7.x86_64                                                                                                                                    21/32 
  Cleanup    : selinux-policy-targeted-3.13.1-166.el7.noarch                                                                                                                                    22/32 
  Cleanup    : policycoreutils-python-2.5-17.1.el7.x86_64                                                                                                                                       23/32 
  Cleanup    : selinux-policy-3.13.1-166.el7.noarch                                                                                                                                             24/32 
  Cleanup    : policycoreutils-2.5-17.1.el7.x86_64                                                                                                                                              25/32 
  Cleanup    : libselinux-utils-2.5-11.el7.x86_64                                                                                                                                               26/32 
  Cleanup    : setools-libs-3.3.8-1.1.el7.x86_64                                                                                                                                                27/32 
  Cleanup    : libselinux-python-2.5-11.el7.x86_64                                                                                                                                              28/32 
  Cleanup    : libsemanage-python-2.5-8.el7.x86_64                                                                                                                                              29/32 
  Cleanup    : libsemanage-2.5-8.el7.x86_64                                                                                                                                                     30/32 
  Cleanup    : libselinux-2.5-11.el7.x86_64                                                                                                                                                     31/32 
  Cleanup    : libsepol-2.5-6.el7.x86_64                                                                                                                                                        32/32 
  Verifying  : fuse-overlayfs-0.7.2-6.el7_8.x86_64                                                                                                                                               1/32 
  Verifying  : libselinux-2.5-15.el7.x86_64                                                                                                                                                      2/32 
  Verifying  : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch                                                                                                                                3/32 
  Verifying  : libselinux-python-2.5-15.el7.x86_64                                                                                                                                               4/32 
  Verifying  : selinux-policy-targeted-3.13.1-268.el7_9.2.noarch                                                                                                                                 5/32 
  Verifying  : docker-ce-rootless-extras-23.0.5-1.el7.x86_64                                                                                                                                     6/32 
  Verifying  : 3:docker-ce-23.0.5-1.el7.x86_64                                                                                                                                                   7/32 
  Verifying  : policycoreutils-2.5-34.el7.x86_64                                                                                                                                                 8/32 
  Verifying  : docker-buildx-plugin-0.10.4-1.el7.x86_64                                                                                                                                          9/32 
  Verifying  : libselinux-utils-2.5-15.el7.x86_64                                                                                                                                               10/32 
  Verifying  : policycoreutils-python-2.5-34.el7.x86_64                                                                                                                                         11/32 
  Verifying  : setools-libs-3.3.8-4.el7.x86_64                                                                                                                                                  12/32 
  Verifying  : fuse3-libs-3.6.1-4.el7.x86_64                                                                                                                                                    13/32 
  Verifying  : libsemanage-python-2.5-14.el7.x86_64                                                                                                                                             14/32 
  Verifying  : libsemanage-2.5-14.el7.x86_64                                                                                                                                                    15/32 
  Verifying  : slirp4netns-0.4.3-4.el7_8.x86_64                                                                                                                                                 16/32 
  Verifying  : libsepol-2.5-10.el7.x86_64                                                                                                                                                       17/32 
  Verifying  : containerd.io-1.6.20-3.1.el7.x86_64                                                                                                                                              18/32 
  Verifying  : selinux-policy-3.13.1-268.el7_9.2.noarch                                                                                                                                         19/32 
  Verifying  : docker-compose-plugin-2.17.3-1.el7.x86_64                                                                                                                                        20/32 
  Verifying  : 1:docker-ce-cli-23.0.5-1.el7.x86_64                                                                                                                                              21/32 
  Verifying  : libselinux-utils-2.5-11.el7.x86_64                                                                                                                                               22/32 
  Verifying  : libselinux-2.5-11.el7.x86_64                                                                                                                                                     23/32 
  Verifying  : policycoreutils-python-2.5-17.1.el7.x86_64                                                                                                                                       24/32 
  Verifying  : selinux-policy-3.13.1-166.el7.noarch                                                                                                                                             25/32 
  Verifying  : libsepol-2.5-6.el7.x86_64                                                                                                                                                        26/32 
  Verifying  : policycoreutils-2.5-17.1.el7.x86_64                                                                                                                                              27/32 
  Verifying  : libsemanage-python-2.5-8.el7.x86_64                                                                                                                                              28/32 
  Verifying  : libsemanage-2.5-8.el7.x86_64                                                                                                                                                     29/32 
  Verifying  : libselinux-python-2.5-11.el7.x86_64                                                                                                                                              30/32 
  Verifying  : selinux-policy-targeted-3.13.1-166.el7.noarch                                                                                                                                    31/32 
  Verifying  : setools-libs-3.3.8-1.1.el7.x86_64                                                                                                                                                32/32 

Installed:
  docker-ce.x86_64 3:23.0.5-1.el7                                                                                                                                                                     

Dependency Installed:
  container-selinux.noarch 2:2.119.2-1.911c772.el7_8      containerd.io.x86_64 0:1.6.20-3.1.el7            docker-buildx-plugin.x86_64 0:0.10.4-1.el7      docker-ce-cli.x86_64 1:23.0.5-1.el7     
  docker-ce-rootless-extras.x86_64 0:23.0.5-1.el7         docker-compose-plugin.x86_64 0:2.17.3-1.el7      fuse-overlayfs.x86_64 0:0.7.2-6.el7_8           fuse3-libs.x86_64 0:3.6.1-4.el7         
  slirp4netns.x86_64 0:0.4.3-4.el7_8                     

Dependency Updated:
  libselinux.x86_64 0:2.5-15.el7                  libselinux-python.x86_64 0:2.5-15.el7                    libselinux-utils.x86_64 0:2.5-15.el7      libsemanage.x86_64 0:2.5-14.el7                
  libsemanage-python.x86_64 0:2.5-14.el7          libsepol.x86_64 0:2.5-10.el7                             policycoreutils.x86_64 0:2.5-34.el7       policycoreutils-python.x86_64 0:2.5-34.el7     
  selinux-policy.noarch 0:3.13.1-268.el7_9.2      selinux-policy-targeted.noarch 0:3.13.1-268.el7_9.2      setools-libs.x86_64 0:3.3.8-4.el7        

Complete!
[root@vms100 ~]#

ステップ 3: docker を起動し、起動時に開始するように設定します。

##########实操验证##########
[root@vms100 ~]# systemctl enable docker --now
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@vms100 ~]#

画像のダウンロードが遅い問題を解決する

docker pull を使用してイメージをプルする場合、デフォルトでは Docker ハブからイメージをプルしますが、中国でこの Web サイトにアクセスすると速度が非常に遅くなる可能性があるため、この問題を解決するには 2 つの方法があります: アクセラレータを設定することと、アクセラレータを使用することです。国内のイメージ。

  1. Alibaba Cloud Accelerator の構成

Alibaba Cloud では、イメージをダウンロードするためのアクセラレータ リンクが提供されています。「Alibaba Cloud コンソール」→「イメージ コンテナ サービス」→「イメージ アクセラレータ」に移動すると、図 1-5 に示すように、Alibaba Cloud が提供するイメージ アクセラレータのアドレスが表示されます。

ステップ 1: /etc/docker/daemon.json を編集します。内容は次のとおりです。

##########实操验证##########
[root@vms100 ~]# cat /etc/docker/daemon.json
{
  "registry-mirrors": ["https://frz7i079.mirror.aliyuncs.com"]
}
[root@vms100 ~]#

ステップ 2: Docker を再起動します。

##########实操验证##########
[root@vms100 ~]# systemctl restart docker 
[root@vms100 ~]#

ステップ 3: nginx イメージのプルをテストします。

##########实操验证##########
[root@vms100 ~]# docker pull nginx
Using default tag:latest 
Trying to pull repository docker.io/library/nginx ...
latest: Pulling from docker.io/library/nginx 
1ab2bdfe9778: Pull complete
a17e64cfe253: Pull complete 
e1288088c7a8: Pull complete
Digest: sha256:53ddb41e46de3d63376579acf46f9a41a8d7de33645db47a486de9769201fec9
Status: Downloaded newer image for docker.io/nginx:latest
[root@vms100 ~]#

アクセラレータを構成した後、Docker 公式ウェアハウスからイメージをすぐにダウンロードできることがわかります。

 

おすすめ

転載: blog.csdn.net/guolianggsta/article/details/131212950