美文网首页
Docker安装CentOS 8.1

Docker安装CentOS 8.1

作者: 努力耕耘少问收获 | 来源:发表于2020-09-07 15:27 被阅读0次

在本教程中,我们将了解如何使用官方Docker存储库在CentOS 8.1上安装和运行Docker CE。

什么是Docker?

Docker是一个开源项目,它允许在容器内部创建和分发应用程序,容器是可以独立于主机系统轻松复制的标准化环境。

添加Docker存储库

之前在Centos7上安装很顺利,没想到相同步骤在Centos8上安装报错了,在此记录下Docker在Centos8环节下的安装:

\1. 安装检查

Docker要求安装环境为 64位系统,且内核在3.8以上。可用uname -r 查看。


111.jpg 222.jpg 333.jpg 444.jpg 555.jpg 66.jpg 777.jpg
Last login: Fri Aug  7 16:47:56 2020 from 118.116.121.205
[root@VM-0-2-centos ~]# uname -r
4.18.0-80.el8.x86_64
[root@VM-0-2-centos ~]# yum list installed | grep docke
[root@VM-0-2-centos ~]# yum -y install docker
Last metadata expiration check: 0:55:59 ago on Fri 07 Aug 2020 04:37:06 PM CST.
No match for argument: docker
Error: Unable to find a match
[root@VM-0-2-centos ~]# systemctl start docker
Failed to start docker.service: Unit docker.service not found.
[root@VM-0-2-centos ~]# cd docker


[root@VM-0-2-centos ~]# curl https://download.docker.com/linux/centos/docker-ce.repo -o /etc/yum.repos.d/docker-ce.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2424  100  2424    0     0    678      0  0:00:03  0:00:03 --:--:--   678
[root@VM-0-2-centos ~]# yum install https://download.docker.com/linux/fedora/30/x86_64/stable/Packages/containerd.io-1.2.6-3.3.fc30.x86_64.rpm
Docker CE Stable - x86_64                                           1.3 kB/s |  25 kB     00:18    
Last metadata expiration check: 0:00:14 ago on Fri 07 Aug 2020 05:35:06 PM CST.
containerd.io-1.2.6-3.3.fc30.x86_64.rpm                             743 kB/s |  21 MB     00:29    
Dependencies resolved.
====================================================================================================
 Package                       Arch    Version                                  Repository     Size
====================================================================================================
Installing:
 containerd.io                 x86_64  1.2.6-3.3.fc30                           @commandline   21 M
Upgrading:
 libselinux                    x86_64  2.9-3.el8                                BaseOS        166 k
 libselinux-utils              x86_64  2.9-3.el8                                BaseOS        244 k
 libsemanage                   x86_64  2.9-2.el8                                BaseOS        165 k
 libsepol                      x86_64  2.9-1.el8                                BaseOS        340 k
 policycoreutils               x86_64  2.9-9.el8                                BaseOS        377 k
 policycoreutils-python-utils  noarch  2.9-9.el8                                BaseOS        251 k
 python3-libselinux            x86_64  2.9-3.el8                                BaseOS        283 k
 python3-libsemanage           x86_64  2.9-2.el8                                BaseOS        127 k
 python3-policycoreutils       noarch  2.9-9.el8                                BaseOS        2.2 M
 selinux-policy                noarch  3.14.3-41.el8_2.4                        BaseOS        614 k
 selinux-policy-targeted       noarch  3.14.3-41.el8_2.4                        BaseOS         15 M
Installing dependencies:
 container-selinux             noarch  2:2.124.0-1.module_el8.2.0+305+5e198a41  AppStream      47 k
Enabling module streams:
 container-tools                       rhel8                                                       

Transaction Summary
====================================================================================================
Install   2 Packages
Upgrade  11 Packages

Total size: 41 M
Total download size: 20 M
Is this ok [y/N]: y
Downloading Packages:
(1/12): container-selinux-2.124.0-1.module_el8.2.0+305+5e198a41.noa 235 kB/s |  47 kB     00:00    
(2/12): libselinux-2.9-3.el8.x86_64.rpm                             484 kB/s | 166 kB     00:00    
(3/12): libselinux-utils-2.9-3.el8.x86_64.rpm                       677 kB/s | 244 kB     00:00    
(4/12): libsemanage-2.9-2.el8.x86_64.rpm                            836 kB/s | 165 kB     00:00    
(5/12): libsepol-2.9-1.el8.x86_64.rpm                               1.5 MB/s | 340 kB     00:00    
(6/12): policycoreutils-2.9-9.el8.x86_64.rpm                        1.6 MB/s | 377 kB     00:00    
(7/12): policycoreutils-python-utils-2.9-9.el8.noarch.rpm           1.2 MB/s | 251 kB     00:00    
(8/12): python3-libsemanage-2.9-2.el8.x86_64.rpm                    1.3 MB/s | 127 kB     00:00    
(9/12): python3-libselinux-2.9-3.el8.x86_64.rpm                     1.8 MB/s | 283 kB     00:00    
(10/12): selinux-policy-3.14.3-41.el8_2.4.noarch.rpm                2.4 MB/s | 614 kB     00:00    
(11/12): python3-policycoreutils-2.9-9.el8.noarch.rpm               3.9 MB/s | 2.2 MB     00:00    
(12/12): selinux-policy-targeted-3.14.3-41.el8_2.4.noarch.rpm        10 MB/s |  15 MB     00:01    
----------------------------------------------------------------------------------------------------
Total                                                               9.1 MB/s |  20 MB     00:02     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                            1/1 
  Running scriptlet: libsepol-2.9-1.el8.x86_64                                                  1/1 
  Upgrading        : libsepol-2.9-1.el8.x86_64                                                 1/24 
  Running scriptlet: libsepol-2.9-1.el8.x86_64                                                 1/24 
  Upgrading        : libselinux-2.9-3.el8.x86_64                                               2/24 
  Running scriptlet: libselinux-2.9-3.el8.x86_64                                               2/24 
  Upgrading        : libselinux-utils-2.9-3.el8.x86_64                                         3/24 
  Upgrading        : libsemanage-2.9-2.el8.x86_64                                              4/24 
  Upgrading        : policycoreutils-2.9-9.el8.x86_64                                          5/24 
  Running scriptlet: policycoreutils-2.9-9.el8.x86_64                                          5/24 
  Upgrading        : selinux-policy-3.14.3-41.el8_2.4.noarch                                   6/24 
  Running scriptlet: selinux-policy-3.14.3-41.el8_2.4.noarch                                   6/24 
  Upgrading        : python3-libselinux-2.9-3.el8.x86_64                                       7/24 
  Upgrading        : python3-libsemanage-2.9-2.el8.x86_64                                      8/24 
  Upgrading        : python3-policycoreutils-2.9-9.el8.noarch                                  9/24 
  Upgrading        : policycoreutils-python-utils-2.9-9.el8.noarch                            10/24 
  Running scriptlet: selinux-policy-targeted-3.14.3-41.el8_2.4.noarch                         11/24 
  Upgrading        : selinux-policy-targeted-3.14.3-41.el8_2.4.noarch                                                                                                                                                                 11/24 
  Running scriptlet: selinux-policy-targeted-3.14.3-41.el8_2.4.noarch                                                                                                                                                                 11/24 
  Running scriptlet: container-selinux-2:2.124.0-1.module_el8.2.0+305+5e198a41.noarch                                                                                                                                                 12/24 
  Installing       : container-selinux-2:2.124.0-1.module_el8.2.0+305+5e198a41.noarch                                                                                                                                                 12/24 
  Running scriptlet: container-selinux-2:2.124.0-1.module_el8.2.0+305+5e198a41.noarch                                                                                                                                                 12/24 
  Installing       : containerd.io-1.2.6-3.3.fc30.x86_64                                                                                                                                                                              13/24 
  Running scriptlet: containerd.io-1.2.6-3.3.fc30.x86_64                                                                                                                                                                              13/24 
  Cleanup          : selinux-policy-targeted-3.14.1-61.el8.noarch                                                                                                                                                                     14/24 
  Running scriptlet: selinux-policy-targeted-3.14.1-61.el8.noarch                                                                                                                                                                     14/24 
  Cleanup          : selinux-policy-3.14.1-61.el8.noarch                                                                                                                                                                              15/24 
  Running scriptlet: selinux-policy-3.14.1-61.el8.noarch                                                                                                                                                                              15/24 
  Cleanup          : policycoreutils-python-utils-2.8-16.1.el8.noarch                                                                                                                                                                 16/24 
  Cleanup          : python3-policycoreutils-2.8-16.1.el8.noarch                                                                                                                                                                      17/24 
  Running scriptlet: policycoreutils-2.8-16.1.el8.x86_64                                                                                                                                                                              18/24 
  Cleanup          : policycoreutils-2.8-16.1.el8.x86_64                                                                                                                                                                              18/24 
  Cleanup          : python3-libsemanage-2.8-5.el8.x86_64                                                                                                                                                                             19/24 
  Cleanup          : libsemanage-2.8-5.el8.x86_64                                                                                                                                                                                     20/24 
  Cleanup          : python3-libselinux-2.8-6.el8.x86_64                                                                                                                                                                              21/24 
  Cleanup          : libselinux-utils-2.8-6.el8.x86_64                                                                                                                                                                                22/24 
  Cleanup          : libselinux-2.8-6.el8.x86_64                                                                                                                                                                                      23/24 
  Cleanup          : libsepol-2.8-2.el8.x86_64                                                                                                                                                                                        24/24 
  Running scriptlet: libsepol-2.8-2.el8.x86_64                                                                                                                                                                                        24/24 
  Running scriptlet: container-selinux-2:2.124.0-1.module_el8.2.0+305+5e198a41.noarch                                                                                                                                                 24/24 
  Running scriptlet: libsepol-2.8-2.el8.x86_64                                                                                                                                                                                        24/24 
  Verifying        : container-selinux-2:2.124.0-1.module_el8.2.0+305+5e198a41.noarch                                                                                                                                                  1/24 
  Verifying        : containerd.io-1.2.6-3.3.fc30.x86_64                                                                                                                                                                               2/24 
  Verifying        : libselinux-2.9-3.el8.x86_64                                                                                                                                                                                       3/24 
  Verifying        : libselinux-2.8-6.el8.x86_64                                                                                                                                                                                       4/24 
  Verifying        : libselinux-utils-2.9-3.el8.x86_64                                                                                                                                                                                 5/24 
  Verifying        : libselinux-utils-2.8-6.el8.x86_64                                                                                                                                                                                 6/24 
  Verifying        : libsemanage-2.9-2.el8.x86_64                                                                                                                                                                                      7/24 
  Verifying        : libsemanage-2.8-5.el8.x86_64                                                                                                                                                                                      8/24 
  Verifying        : libsepol-2.9-1.el8.x86_64                                                                                                                                                                                         9/24 
  Verifying        : libsepol-2.8-2.el8.x86_64                                                                                                                                                                                        10/24 
  Verifying        : policycoreutils-2.9-9.el8.x86_64                                                                                                                                                                                 11/24 
  Verifying        : policycoreutils-2.8-16.1.el8.x86_64                                                                                                                                                                              12/24 
  Verifying        : policycoreutils-python-utils-2.9-9.el8.noarch                                                                                                                                                                    13/24 
  Verifying        : policycoreutils-python-utils-2.8-16.1.el8.noarch                                                                                                                                                                 14/24 
  Verifying        : python3-libselinux-2.9-3.el8.x86_64                                                                                                                                                                              15/24 
  Verifying        : python3-libselinux-2.8-6.el8.x86_64                                                                                                                                                                              16/24 
  Verifying        : python3-libsemanage-2.9-2.el8.x86_64                                                                                                                                                                             17/24 
  Verifying        : python3-libsemanage-2.8-5.el8.x86_64                                                                                                                                                                             18/24 
  Verifying        : python3-policycoreutils-2.9-9.el8.noarch                                                                                                                                                                         19/24 
  Verifying        : python3-policycoreutils-2.8-16.1.el8.noarch                                                                                                                                                                      20/24 
  Verifying        : selinux-policy-3.14.3-41.el8_2.4.noarch                                                                                                                                                                          21/24 
  Verifying        : selinux-policy-3.14.1-61.el8.noarch                                                                                                                                                                              22/24 
  Verifying        : selinux-policy-targeted-3.14.3-41.el8_2.4.noarch                                                                                                                                                                 23/24 
  Verifying        : selinux-policy-targeted-3.14.1-61.el8.noarch                                                                                                                                                                     24/24 

Upgraded:
  libselinux-2.9-3.el8.x86_64                            libselinux-utils-2.9-3.el8.x86_64         libsemanage-2.9-2.el8.x86_64               libsepol-2.9-1.el8.x86_64                      policycoreutils-2.9-9.el8.x86_64             
  policycoreutils-python-utils-2.9-9.el8.noarch          python3-libselinux-2.9-3.el8.x86_64       python3-libsemanage-2.9-2.el8.x86_64       python3-policycoreutils-2.9-9.el8.noarch       selinux-policy-3.14.3-41.el8_2.4.noarch      
  selinux-policy-targeted-3.14.3-41.el8_2.4.noarch      

Installed:
  containerd.io-1.2.6-3.3.fc30.x86_64                                                                    container-selinux-2:2.124.0-1.module_el8.2.0+305+5e198a41.noarch                                                                   

Complete!
[root@VM-0-2-centos ~]# yum install docker-ce
Last metadata expiration check: 0:01:56 ago on Fri 07 Aug 2020 05:35:06 PM CST.
Dependencies resolved.
============================================================================================================================================================================================================================================
 Package                                                  Arch                                              Version                                                       Repository                                                   Size
============================================================================================================================================================================================================================================
Installing:
 docker-ce                                                x86_64                                            3:19.03.12-3.el7                                              docker-ce-stable                                             24 M
Installing dependencies:
 libcgroup                                                x86_64                                            0.41-19.el8                                                   BaseOS                                                       70 k
 docker-ce-cli                                            x86_64                                            1:19.03.12-3.el7                                              docker-ce-stable                                             38 M

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

Total download size: 62 M
Installed size: 263 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): libcgroup-0.41-19.el8.x86_64.rpm                                                                                                                                                                      56 kB/s |  70 kB     00:01    
[MIRROR] docker-ce-cli-19.03.12-3.el7.x86_64.rpm: Curl error (28): Timeout was reached for https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-cli-19.03.12-3.el7.x86_64.rpm [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
[MIRROR] docker-ce-19.03.12-3.el7.x86_64.rpm: Curl error (28): Timeout was reached for https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-19.03.12-3.el7.x86_64.rpm [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
[FAILED] docker-ce-19.03.12-3.el7.x86_64.rpm: No more mirrors to try - All mirrors were already tried without success                                                                                                                      
(3/3): docker-ce-cli-19.03.12-3.el7.x86_64.rpm                                                     40% [=======================================-                                                          ] 2.8 MB/s |  25 MB     00:13 ETA
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Error: Error downloading packages:
  Cannot download Packages/docker-ce-19.03.12-3.el7.x86_64.rpm: All mirrors were tried
[root@VM-0-2-centos ~]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
-bash: yum-config-manager: command not found
[root@VM-0-2-centos ~]# sudo yum install -y yum-utils  device-mapper-persistent-data  lvm2
Docker CE Stable - x86_64                                                                                                                                                                                   1.7 kB/s | 3.5 kB     00:02    
Package device-mapper-persistent-data-0.7.6-1.el8.x86_64 is already installed.
Package lvm2-8:2.03.02-6.el8.x86_64 is already installed.
Dependencies resolved.
============================================================================================================================================================================================================================================
 Package                                                                 Arch                                             Version                                                    Repository                                        Size
============================================================================================================================================================================================================================================
Installing:
 yum-utils                                                               noarch                                           4.0.12-3.el8                                               BaseOS                                            66 k
Upgrading:
 device-mapper                                                           x86_64                                           8:1.02.169-3.el8                                           BaseOS                                           372 k
 device-mapper-event                                                     x86_64                                           8:1.02.169-3.el8                                           BaseOS                                           267 k
 device-mapper-event-libs                                                x86_64                                           8:1.02.169-3.el8                                           BaseOS                                           266 k
 device-mapper-libs                                                      x86_64                                           8:1.02.169-3.el8                                           BaseOS                                           405 k
 device-mapper-persistent-data                                           x86_64                                           0.8.5-3.el8                                                BaseOS                                           470 k
 dnf                                                                     noarch                                           4.2.17-6.el8                                               BaseOS                                           469 k
 dnf-data                                                                noarch                                           4.2.17-6.el8                                               BaseOS                                           145 k
 dnf-plugins-core                                                        noarch                                           4.0.12-3.el8                                               BaseOS                                            64 k
 libdnf                                                                  x86_64                                           0.39.1-5.el8                                               BaseOS                                           620 k
 librepo                                                                 x86_64                                           1.11.0-2.el8                                               BaseOS                                            90 k
 libsolv                                                                 x86_64                                           0.7.7-1.el8                                                BaseOS                                           356 k
 lvm2                                                                    x86_64                                           8:2.03.08-3.el8                                            BaseOS                                           1.5 M
 lvm2-libs                                                               x86_64                                           8:2.03.08-3.el8                                            BaseOS                                           1.1 M
 python3-dnf                                                             noarch                                           4.2.17-6.el8                                               BaseOS                                           521 k
 python3-dnf-plugins-core                                                noarch                                           4.0.12-3.el8                                               BaseOS                                           203 k
 python3-hawkey                                                          x86_64                                           0.39.1-5.el8                                               BaseOS                                            99 k
 python3-libdnf                                                          x86_64                                           0.39.1-5.el8                                               BaseOS                                           689 k
 python3-librepo                                                         x86_64                                           1.11.0-2.el8                                               BaseOS                                            52 k
 python3-rpm                                                             x86_64                                           4.14.2-37.el8                                              BaseOS                                           156 k
 rpm                                                                     x86_64                                           4.14.2-37.el8                                              BaseOS                                           540 k
 rpm-build-libs                                                          x86_64                                           4.14.2-37.el8                                              BaseOS                                           154 k
 rpm-libs                                                                x86_64                                           4.14.2-37.el8                                              BaseOS                                           337 k
 rpm-plugin-selinux                                                      x86_64                                           4.14.2-37.el8                                              BaseOS                                            75 k
 rpm-plugin-systemd-inhibit                                              x86_64                                           4.14.2-37.el8                                              BaseOS                                            76 k
 yum                                                                     noarch                                           4.2.17-6.el8                                               BaseOS                                           193 k
Installing dependencies:
 libzstd                                                                 x86_64                                           1.4.2-2.el8                                                BaseOS                                           260 k

Transaction Summary
============================================================================================================================================================================================================================================
Install   2 Packages
Upgrade  25 Packages

Total download size: 9.4 M
Downloading Packages:
(1/27): yum-utils-4.0.12-3.el8.noarch.rpm                                                                                                                                                                   329 kB/s |  66 kB     00:00    
(2/27): libzstd-1.4.2-2.el8.x86_64.rpm                                                                                                                                                                      771 kB/s | 260 kB     00:00    
(3/27): device-mapper-1.02.169-3.el8.x86_64.rpm                                                                                                                                                             988 kB/s | 372 kB     00:00    
(4/27): device-mapper-event-1.02.169-3.el8.x86_64.rpm                                                                                                                                                       1.1 MB/s | 267 kB     00:00    
(5/27): device-mapper-event-libs-1.02.169-3.el8.x86_64.rpm                                                                                                                                                  1.5 MB/s | 266 kB     00:00    
(6/27): device-mapper-libs-1.02.169-3.el8.x86_64.rpm                                                                                                                                                        1.8 MB/s | 405 kB     00:00    
(7/27): dnf-data-4.2.17-6.el8.noarch.rpm                                                                                                                                                                    1.9 MB/s | 145 kB     00:00    
(8/27): device-mapper-persistent-data-0.8.5-3.el8.x86_64.rpm                                                                                                                                                1.8 MB/s | 470 kB     00:00    
(9/27): dnf-plugins-core-4.0.12-3.el8.noarch.rpm                                                                                                                                                            1.7 MB/s |  64 kB     00:00    
(10/27): dnf-4.2.17-6.el8.noarch.rpm                                                                                                                                                                        2.0 MB/s | 469 kB     00:00    
(11/27): librepo-1.11.0-2.el8.x86_64.rpm                                                                                                                                                                    1.2 MB/s |  90 kB     00:00    
(12/27): libsolv-0.7.7-1.el8.x86_64.rpm                                                                                                                                                                     2.5 MB/s | 356 kB     00:00    
(13/27): libdnf-0.39.1-5.el8.x86_64.rpm                                                                                                                                                                     2.8 MB/s | 620 kB     00:00    
(14/27): python3-dnf-4.2.17-6.el8.noarch.rpm                                                                                                                                                                4.4 MB/s | 521 kB     00:00    
(15/27): lvm2-libs-2.03.08-3.el8.x86_64.rpm                                                                                                                                                                 4.8 MB/s | 1.1 MB     00:00    
(16/27): python3-dnf-plugins-core-4.0.12-3.el8.noarch.rpm                                                                                                                                                   2.3 MB/s | 203 kB     00:00    
(17/27): lvm2-2.03.08-3.el8.x86_64.rpm                                                                                                                                                                      4.1 MB/s | 1.5 MB     00:00    
(18/27): python3-hawkey-0.39.1-5.el8.x86_64.rpm                                                                                                                                                             2.1 MB/s |  99 kB     00:00    
(19/27): python3-librepo-1.11.0-2.el8.x86_64.rpm                                                                                                                                                            1.2 MB/s |  52 kB     00:00    
(20/27): python3-rpm-4.14.2-37.el8.x86_64.rpm                                                                                                                                                               2.1 MB/s | 156 kB     00:00    
(21/27): python3-libdnf-0.39.1-5.el8.x86_64.rpm                                                                                                                                                             4.6 MB/s | 689 kB     00:00    
(22/27): rpm-build-libs-4.14.2-37.el8.x86_64.rpm                                                                                                                                                            2.2 MB/s | 154 kB     00:00    
(23/27): rpm-4.14.2-37.el8.x86_64.rpm                                                                                                                                                                       4.8 MB/s | 540 kB     00:00    
(24/27): rpm-plugin-selinux-4.14.2-37.el8.x86_64.rpm                                                                                                                                                        1.8 MB/s |  75 kB     00:00    
(25/27): rpm-plugin-systemd-inhibit-4.14.2-37.el8.x86_64.rpm                                                                                                                                                2.0 MB/s |  76 kB     00:00    
(26/27): rpm-libs-4.14.2-37.el8.x86_64.rpm                                                                                                                                                                  2.9 MB/s | 337 kB     00:00    
(27/27): yum-4.2.17-6.el8.noarch.rpm                                                                                                                                                                        4.3 MB/s | 193 kB     00:00    
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                       6.8 MB/s | 9.4 MB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                                                    1/1 
  Running scriptlet: libzstd-1.4.2-2.el8.x86_64                                                                                                                                                                                         1/1 
  Installing       : libzstd-1.4.2-2.el8.x86_64                                                                                                                                                                                        1/52 
  Upgrading        : librepo-1.11.0-2.el8.x86_64                                                                                                                                                                                       2/52 
  Upgrading        : device-mapper-libs-8:1.02.169-3.el8.x86_64                                                                                                                                                                        3/52 
  Upgrading        : device-mapper-8:1.02.169-3.el8.x86_64                                                                                                                                                                             4/52 
  Upgrading        : device-mapper-event-libs-8:1.02.169-3.el8.x86_64                                                                                                                                                                  5/52 
  Upgrading        : device-mapper-event-8:1.02.169-3.el8.x86_64                                                                                                                                                                       6/52 
  Running scriptlet: device-mapper-event-8:1.02.169-3.el8.x86_64                                                                                                                                                                       6/52 
  Upgrading        : lvm2-libs-8:2.03.08-3.el8.x86_64                                                                                                                                                                                  7/52 
  Upgrading        : rpm-4.14.2-37.el8.x86_64                                                                                                                                                                                          8/52 
  Upgrading        : rpm-libs-4.14.2-37.el8.x86_64                                                                                                                                                                                     9/52 
  Running scriptlet: rpm-libs-4.14.2-37.el8.x86_64                                                                                                                                                                                     9/52 
  Upgrading        : libsolv-0.7.7-1.el8.x86_64                                                                                                                                                                                       10/52 
  Upgrading        : libdnf-0.39.1-5.el8.x86_64                                                                                                                                                                                       11/52 
  Upgrading        : python3-libdnf-0.39.1-5.el8.x86_64                                                                                                                                                                               12/52 
  Upgrading        : python3-hawkey-0.39.1-5.el8.x86_64                                                                                                                                                                               13/52 
  Upgrading        : rpm-build-libs-4.14.2-37.el8.x86_64                                                                                                                                                                              14/52 
  Running scriptlet: rpm-build-libs-4.14.2-37.el8.x86_64                                                                                                                                                                              14/52 
  Upgrading        : python3-rpm-4.14.2-37.el8.x86_64                                                                                                                                                                                 15/52 
  Upgrading        : rpm-plugin-systemd-inhibit-4.14.2-37.el8.x86_64                                                                                                                                                                  16/52 
  Upgrading        : dnf-data-4.2.17-6.el8.noarch                                                                                                                                                                                     17/52 
  Upgrading        : python3-dnf-4.2.17-6.el8.noarch                                                                                                                                                                                  18/52 
  Upgrading        : dnf-4.2.17-6.el8.noarch                                                                                                                                                                                          19/52 
  Running scriptlet: dnf-4.2.17-6.el8.noarch                                                                                                                                                                                          19/52 
  Upgrading        : python3-dnf-plugins-core-4.0.12-3.el8.noarch                                                                                                                                                                     20/52 
  Upgrading        : dnf-plugins-core-4.0.12-3.el8.noarch                                                                                                                                                                             21/52 
  Upgrading        : device-mapper-persistent-data-0.8.5-3.el8.x86_64                                                                                                                                                                 22/52 
  Upgrading        : lvm2-8:2.03.08-3.el8.x86_64                                                                                                                                                                                      23/52 
  Running scriptlet: lvm2-8:2.03.08-3.el8.x86_64                                                                                                                                                                                      23/52 
  Installing       : yum-utils-4.0.12-3.el8.noarch                                                                                                                                                                                    24/52 
  Upgrading        : yum-4.2.17-6.el8.noarch                                                                                                                                                                                          25/52 
  Upgrading        : rpm-plugin-selinux-4.14.2-37.el8.x86_64                                                                                                                                                                          26/52 
  Upgrading        : python3-librepo-1.11.0-2.el8.x86_64                                                                                                                                                                              27/52 
  Cleanup          : yum-4.0.9.2-5.el8.noarch                                                                                                                                                                                         28/52 
  Running scriptlet: dnf-4.0.9.2-5.el8.noarch                                                                                                                                                                                         29/52 
  Cleanup          : dnf-4.0.9.2-5.el8.noarch                                                                                                                                                                                         29/52 
  Running scriptlet: dnf-4.0.9.2-5.el8.noarch                                                                                                                                                                                         29/52 
  Cleanup          : dnf-plugins-core-4.0.2.2-3.el8.noarch                                                                                                                                                                            30/52 
  Running scriptlet: lvm2-8:2.03.02-6.el8.x86_64                                                                                                                                                                                      31/52 
  Cleanup          : lvm2-8:2.03.02-6.el8.x86_64                                                                                                                                                                                      31/52 
  Running scriptlet: lvm2-8:2.03.02-6.el8.x86_64                                                                                                                                                                                      31/52 
  Cleanup          : lvm2-libs-8:2.03.02-6.el8.x86_64                                                                                                                                                                                 32/52 
  Running scriptlet: lvm2-libs-8:2.03.02-6.el8.x86_64                                                                                                                                                                                 32/52 
  Running scriptlet: device-mapper-event-8:1.02.155-6.el8.x86_64                                                                                                                                                                      33/52 
  Cleanup          : device-mapper-event-8:1.02.155-6.el8.x86_64                                                                                                                                                                      33/52 
  Cleanup          : device-mapper-event-libs-8:1.02.155-6.el8.x86_64                                                                                                                                                                 34/52 
  Running scriptlet: device-mapper-event-libs-8:1.02.155-6.el8.x86_64                                                                                                                                                                 34/52 
  Cleanup          : rpm-plugin-selinux-4.14.2-9.el8.x86_64                                                                                                                                                                           35/52 
  Cleanup          : python3-dnf-plugins-core-4.0.2.2-3.el8.noarch                                                                                                                                                                    36/52 
  Cleanup          : python3-dnf-4.0.9.2-5.el8.noarch                                                                                                                                                                                 37/52 
  Cleanup          : python3-hawkey-0.22.5-4.el8.x86_64                                                                                                                                                                               38/52 
  Cleanup          : python3-libdnf-0.22.5-4.el8.x86_64                                                                                                                                                                               39/52 
  Cleanup          : libdnf-0.22.5-4.el8.x86_64                                                                                                                                                                                       40/52 
  Cleanup          : python3-rpm-4.14.2-9.el8.x86_64                                                                                                                                                                                  41/52 
  Cleanup          : rpm-build-libs-4.14.2-9.el8.x86_64                                                                                                                                                                               42/52 
  Running scriptlet: rpm-build-libs-4.14.2-9.el8.x86_64                                                                                                                                                                               42/52 
  Cleanup          : rpm-plugin-systemd-inhibit-4.14.2-9.el8.x86_64                                                                                                                                                                   43/52 
  Cleanup          : libsolv-0.6.35-6.el8.x86_64                                                                                                                                                                                      44/52 
  Cleanup          : python3-librepo-1.9.2-1.el8.x86_64                                                                                                                                                                               45/52 
  Cleanup          : rpm-4.14.2-9.el8.x86_64                                                                                                                                                                                          46/52 
  Cleanup          : rpm-libs-4.14.2-9.el8.x86_64                                                                                                                                                                                     47/52 
  Running scriptlet: rpm-libs-4.14.2-9.el8.x86_64                                                                                                                                                                                     47/52 
  Cleanup          : device-mapper-libs-8:1.02.155-6.el8.x86_64                                                                                                                                                                       48/52 
  Running scriptlet: device-mapper-libs-8:1.02.155-6.el8.x86_64                                                                                                                                                                       48/52 
  Cleanup          : device-mapper-8:1.02.155-6.el8.x86_64                                                                                                                                                                            49/52 
  Cleanup          : dnf-data-4.0.9.2-5.el8.noarch                                                                                                                                                                                    50/52 
  Cleanup          : librepo-1.9.2-1.el8.x86_64                                                                                                                                                                                       51/52 
  Cleanup          : device-mapper-persistent-data-0.7.6-1.el8.x86_64                                                                                                                                                                 52/52 
  Running scriptlet: device-mapper-persistent-data-0.7.6-1.el8.x86_64                                                                                                                                                                 52/52 
  Verifying        : libzstd-1.4.2-2.el8.x86_64                                                                                                                                                                                        1/52 
  Verifying        : yum-utils-4.0.12-3.el8.noarch                                                                                                                                                                                     2/52 
  Verifying        : device-mapper-8:1.02.169-3.el8.x86_64                                                                                                                                                                             3/52 
  Verifying        : device-mapper-8:1.02.155-6.el8.x86_64                                                                                                                                                                             4/52 
  Verifying        : device-mapper-event-8:1.02.169-3.el8.x86_64                                                                                                                                                                       5/52 
  Verifying        : device-mapper-event-8:1.02.155-6.el8.x86_64                                                                                                                                                                       6/52 
  Verifying        : device-mapper-event-libs-8:1.02.169-3.el8.x86_64                                                                                                                                                                  7/52 
  Verifying        : device-mapper-event-libs-8:1.02.155-6.el8.x86_64                                                                                                                                                                  8/52 
  Verifying        : device-mapper-libs-8:1.02.169-3.el8.x86_64                                                                                                                                                                        9/52 
  Verifying        : device-mapper-libs-8:1.02.155-6.el8.x86_64                                                                                                                                                                       10/52 
  Verifying        : device-mapper-persistent-data-0.8.5-3.el8.x86_64                                                                                                                                                                 11/52 
  Verifying        : device-mapper-persistent-data-0.7.6-1.el8.x86_64                                                                                                                                                                 12/52 
  Verifying        : dnf-4.2.17-6.el8.noarch                                                                                                                                                                                          13/52 
  Verifying        : dnf-4.0.9.2-5.el8.noarch                                                                                                                                                                                         14/52 
  Verifying        : dnf-data-4.2.17-6.el8.noarch                                                                                                                                                                                     15/52 
  Verifying        : dnf-data-4.0.9.2-5.el8.noarch                                                                                                                                                                                    16/52 
  Verifying        : dnf-plugins-core-4.0.12-3.el8.noarch                                                                                                                                                                             17/52 
  Verifying        : dnf-plugins-core-4.0.2.2-3.el8.noarch                                                                                                                                                                            18/52 
  Verifying        : libdnf-0.39.1-5.el8.x86_64                                                                                                                                                                                       19/52 
  Verifying        : libdnf-0.22.5-4.el8.x86_64                                                                                                                                                                                       20/52 
  Verifying        : librepo-1.11.0-2.el8.x86_64                                                                                                                                                                                      21/52 
  Verifying        : librepo-1.9.2-1.el8.x86_64                                                                                                                                                                                       22/52 
  Verifying        : libsolv-0.7.7-1.el8.x86_64                                                                                                                                                                                       23/52 
  Verifying        : libsolv-0.6.35-6.el8.x86_64                                                                                                                                                                                      24/52 
  Verifying        : lvm2-8:2.03.08-3.el8.x86_64                                                                                                                                                                                      25/52 
  Verifying        : lvm2-8:2.03.02-6.el8.x86_64                                                                                                                                                                                      26/52 
  Verifying        : lvm2-libs-8:2.03.08-3.el8.x86_64                                                                                                                                                                                 27/52 
  Verifying        : lvm2-libs-8:2.03.02-6.el8.x86_64                                                                                                                                                                                 28/52 
  Verifying        : python3-dnf-4.2.17-6.el8.noarch                                                                                                                                                                                  29/52 
  Verifying        : python3-dnf-4.0.9.2-5.el8.noarch                                                                                                                                                                                 30/52 
  Verifying        : python3-dnf-plugins-core-4.0.12-3.el8.noarch                                                                                                                                                                     31/52 
  Verifying        : python3-dnf-plugins-core-4.0.2.2-3.el8.noarch                                                                                                                                                                    32/52 
  Verifying        : python3-hawkey-0.39.1-5.el8.x86_64                                                                                                                                                                               33/52 
  Verifying        : python3-hawkey-0.22.5-4.el8.x86_64                                                                                                                                                                               34/52 
  Verifying        : python3-libdnf-0.39.1-5.el8.x86_64                                                                                                                                                                               35/52 
  Verifying        : python3-libdnf-0.22.5-4.el8.x86_64                                                                                                                                                                               36/52 
  Verifying        : python3-librepo-1.11.0-2.el8.x86_64                                                                                                                                                                              37/52 
  Verifying        : python3-librepo-1.9.2-1.el8.x86_64                                                                                                                                                                               38/52 
  Verifying        : python3-rpm-4.14.2-37.el8.x86_64                                                                                                                                                                                 39/52 
  Verifying        : python3-rpm-4.14.2-9.el8.x86_64                                                                                                                                                                                  40/52 
  Verifying        : rpm-4.14.2-37.el8.x86_64                                                                                                                                                                                         41/52 
  Verifying        : rpm-4.14.2-9.el8.x86_64                                                                                                                                                                                          42/52 
  Verifying        : rpm-build-libs-4.14.2-37.el8.x86_64                                                                                                                                                                              43/52 
  Verifying        : rpm-build-libs-4.14.2-9.el8.x86_64                                                                                                                                                                               44/52 
  Verifying        : rpm-libs-4.14.2-37.el8.x86_64                                                                                                                                                                                    45/52 
  Verifying        : rpm-libs-4.14.2-9.el8.x86_64                                                                                                                                                                                     46/52 
  Verifying        : rpm-plugin-selinux-4.14.2-37.el8.x86_64                                                                                                                                                                          47/52 
  Verifying        : rpm-plugin-selinux-4.14.2-9.el8.x86_64                                                                                                                                                                           48/52 
  Verifying        : rpm-plugin-systemd-inhibit-4.14.2-37.el8.x86_64                                                                                                                                                                  49/52 
  Verifying        : rpm-plugin-systemd-inhibit-4.14.2-9.el8.x86_64                                                                                                                                                                   50/52 
  Verifying        : yum-4.2.17-6.el8.noarch                                                                                                                                                                                          51/52 
  Verifying        : yum-4.0.9.2-5.el8.noarch                                                                                                                                                                                         52/52 

Upgraded:
  device-mapper-8:1.02.169-3.el8.x86_64  device-mapper-event-8:1.02.169-3.el8.x86_64  device-mapper-event-libs-8:1.02.169-3.el8.x86_64  device-mapper-libs-8:1.02.169-3.el8.x86_64       device-mapper-persistent-data-0.8.5-3.el8.x86_64 
  dnf-4.2.17-6.el8.noarch                dnf-data-4.2.17-6.el8.noarch                 dnf-plugins-core-4.0.12-3.el8.noarch              libdnf-0.39.1-5.el8.x86_64                       librepo-1.11.0-2.el8.x86_64                      
  libsolv-0.7.7-1.el8.x86_64             lvm2-8:2.03.08-3.el8.x86_64                  lvm2-libs-8:2.03.08-3.el8.x86_64                  python3-dnf-4.2.17-6.el8.noarch                  python3-dnf-plugins-core-4.0.12-3.el8.noarch     
  python3-hawkey-0.39.1-5.el8.x86_64     python3-libdnf-0.39.1-5.el8.x86_64           python3-librepo-1.11.0-2.el8.x86_64               python3-rpm-4.14.2-37.el8.x86_64                 rpm-4.14.2-37.el8.x86_64                         
  rpm-build-libs-4.14.2-37.el8.x86_64    rpm-libs-4.14.2-37.el8.x86_64                rpm-plugin-selinux-4.14.2-37.el8.x86_64           rpm-plugin-systemd-inhibit-4.14.2-37.el8.x86_64  yum-4.2.17-6.el8.noarch                          

Installed:
  yum-utils-4.0.12-3.el8.noarch                                                                                          libzstd-1.4.2-2.el8.x86_64                                                                                         

Complete!

\2. 安装依赖

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

[root@VM-0-2-centos ~]# sudo yum install -y yum-utils  device-mapper-persistent-data  lvm2
Last metadata expiration check: 0:00:12 ago on Fri 07 Aug 2020 05:45:55 PM CST.
Package yum-utils-4.0.12-3.el8.noarch is already installed.
Package device-mapper-persistent-data-0.8.5-3.el8.x86_64 is already installed.
Package lvm2-8:2.03.08-3.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[root@VM-0-2-centos ~]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Adding repo from: https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[root@VM-0-2-centos ~]# yum install docker-ce
Docker CE Stable - x86_64                                                                                                                                                                                   167 kB/s |  25 kB     00:00    
Dependencies resolved.
============================================================================================================================================================================================================================================
 Package                                                  Architecture                                      Version                                                       Repository                                                   Size
============================================================================================================================================================================================================================================
Installing:
 docker-ce                                                x86_64                                            3:19.03.12-3.el7                                              docker-ce-stable                                             24 M
Installing dependencies:
 docker-ce-cli                                            x86_64                                            1:19.03.12-3.el7                                              docker-ce-stable                                             38 M
 libcgroup                                                x86_64                                            0.41-19.el8                                                   BaseOS                                                       70 k

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

Total download size: 62 M
Installed size: 263 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): libcgroup-0.41-19.el8.x86_64.rpm                                                                                                                                                                     278 kB/s |  70 kB     00:00    
(2/3): docker-ce-cli-19.03.12-3.el7.x86_64.rpm                                                                                                                                                              9.5 MB/s |  38 MB     00:04    
(3/3): docker-ce-19.03.12-3.el7.x86_64.rpm                                                                                                                                                                  4.4 MB/s |  24 MB     00:05    
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                        11 MB/s |  62 MB     00:05     
warning: /var/cache/dnf/docker-ce-stable-3e5647bf4960c796/packages/docker-ce-19.03.12-3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Docker CE Stable - x86_64                                                                                                                                                                                    36 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://mirrors.aliyun.com/docker-ce/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-ce-cli-1:19.03.12-3.el7.x86_64                                                                                                                                                                              1/3 
  Running scriptlet: docker-ce-cli-1:19.03.12-3.el7.x86_64                                                                                                                                                                              1/3 
  Running scriptlet: libcgroup-0.41-19.el8.x86_64                                                                                                                                                                                       2/3 
  Installing       : libcgroup-0.41-19.el8.x86_64                                                                                                                                                                                       2/3 
  Running scriptlet: libcgroup-0.41-19.el8.x86_64                                                                                                                                                                                       2/3 
  Installing       : docker-ce-3:19.03.12-3.el7.x86_64                                                                                                                                                                                  3/3 
  Running scriptlet: docker-ce-3:19.03.12-3.el7.x86_64                                                                                                                                                                                  3/3 
  Verifying        : libcgroup-0.41-19.el8.x86_64                                                                                                                                                                                       1/3 
  Verifying        : docker-ce-3:19.03.12-3.el7.x86_64                                                                                                                                                                                  2/3 
  Verifying        : docker-ce-cli-1:19.03.12-3.el7.x86_64                                                                                                                                                                              3/3 

Installed:
  docker-ce-3:19.03.12-3.el7.x86_64                                             docker-ce-cli-1:19.03.12-3.el7.x86_64                                             libcgroup-0.41-19.el8.x86_64                                            

Complete!

检查版本

[root@VM-0-2-centos ~]# docker -v
Docker version 19.03.12, build 48a66213fe


启动docker

[root@VM-0-2-centos ~]# systemctl start docker
[root@VM-0-2-centos ~]# systemctl status  docker
鈼[0m docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Fri 2020-08-07 17:48:25 CST; 6s ago
     Docs: https://docs.docker.com
 Main PID: 31857 (dockerd)
    Tasks: 8
   Memory: 42.0M
   CGroup: /system.slice/docker.service
           鈹斺攢31857 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Aug 07 17:48:25 VM-0-2-centos dockerd[31857]: time="2020-08-07T17:48:25.158402699+08:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Aug 07 17:48:25 VM-0-2-centos dockerd[31857]: time="2020-08-07T17:48:25.244449414+08:00" level=warning msg="Your kernel does not support cgroup blkio weight"
Aug 07 17:48:25 VM-0-2-centos dockerd[31857]: time="2020-08-07T17:48:25.244472668+08:00" level=warning msg="Your kernel does not support cgroup blkio weight_device"
Aug 07 17:48:25 VM-0-2-centos dockerd[31857]: time="2020-08-07T17:48:25.244578325+08:00" level=info msg="Loading containers: start."
Aug 07 17:48:25 VM-0-2-centos dockerd[31857]: time="2020-08-07T17:48:25.404514975+08:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP addre>
Aug 07 17:48:25 VM-0-2-centos dockerd[31857]: time="2020-08-07T17:48:25.505130171+08:00" level=info msg="Loading containers: done."
Aug 07 17:48:25 VM-0-2-centos dockerd[31857]: time="2020-08-07T17:48:25.538967372+08:00" level=info msg="Docker daemon" commit=48a66213fe graphdriver(s)=overlay2 version=19.03.12
Aug 07 17:48:25 VM-0-2-centos dockerd[31857]: time="2020-08-07T17:48:25.539052551+08:00" level=info msg="Daemon has completed initialization"
Aug 07 17:48:25 VM-0-2-centos dockerd[31857]: time="2020-08-07T17:48:25.596654279+08:00" level=info msg="API listen on /var/run/docker.sock"
Aug 07 17:48:25 VM-0-2-centos systemd[1]: Started Docker Application Container Engine.
lines 1-20/20 (END)

[root@VM-0-2-centos ~]# 
[root@VM-0-2-centos ~]# 
[root@VM-0-2-centos ~]# 
[root@VM-0-2-centos ~]# 

相关文章

  • 新的故事-安装MySQL

    一、安装MySQL 小目录 在windows 8.1安装mysql在centos7安装mysql通过docker安...

  • Docker安装CentOS 8.1

    在本教程中,我们将了解如何使用官方Docker存储库在CentOS 8.1上安装和运行Docker CE。 什么是...

  • CentOS 8.1 安装Docker

    1、卸载已安装的Docker 2、安装前的准备    A)安装基础包    B)设置稳定仓库    注:阿里仓库,...

  • CentOS 8.1 安装docker

    参考 https://juejin.im/post/5e3032575188252c6e182a55 软件更新 把...

  • # Docker安装

    在本教程中,我们将了解如何使用官方Docker存储库在CentOS 8.1上安装和运行Docker CE。 什么是...

  • 在CentOS 8.1上安装 Docker

    在本教程中,我们将了解如何使用官方Docker存储库在CentOS 8.1上安装和运行Docker CE。 什么是...

  • linux下UI自动化部署(selenium+zalenium)

    环境 linux:centos7.5 安装docker centos下docker安装 安装docker-sele...

  • 部署docker虚拟化平台

    CentOS Docker 安装 使用 yum 安装(CentOS 7下) Docker 要求 CentOS 系统...

  • docker常用命令

    docker 环境 CentOS 8.1 Docker 修改镜像源地址 Docker 官方中国区 网易 ustc ...

  • CentOS8.1安装docker

    Docker官网地址:https://www.docker.comDocker软件镜像查询地址:https://h...

网友评论

      本文标题:Docker安装CentOS 8.1

      本文链接:https://www.haomeiwen.com/subject/ftqlektx.html