zoukankan      html  css  js  c++  java
  • Centos 7 安装docker

    环境

    • CentOS Linux release 7.6.1810 (Core)

    创建安装脚本

    新建一个install_docker.sh文件,并写入以下内容:

    #!/usr/bin/bash
    #
    
    # 卸载老版本
    sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
    # 安装必要的工具包
    sudo yum install -y yum-utils device-mapper-persistent-data lvm2
    # 添加软件源信息
    sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
    # 安装docker-ce
    sudo yum -y install docker-ce docker-ce-cli containerd.io
    # 启动docker服务
    sudo systemctl start docker
    

    然后执行该脚本:

    sh install_docker.sh
    

    然后根据提示输入密码就OK了。

    屏幕输出信息

    过程如下:

    (WeChat) [master@bogon docker]$ sh docker_install.sh 
    [sudo] password for master: 
    Loaded plugins: fastestmirror
    No Match for argument: docker
    No Match for argument: docker-client
    No Match for argument: docker-client-latest
    No Match for argument: docker-common
    No Match for argument: docker-latest
    No Match for argument: docker-latest-logrotate
    No Match for argument: docker-logrotate
    No Match for argument: docker-engine
    No Packages marked for removal
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    Package device-mapper-persistent-data-0.7.3-3.el7.x86_64 already installed and latest version
    Package 7:lvm2-2.02.180-10.el7_6.7.x86_64 already installed and latest version
    Resolving Dependencies
    --> Running transaction check
    ---> Package yum-utils.noarch 0:1.1.31-50.el7 will be installed
    --> Processing Dependency: python-kitchen for package: yum-utils-1.1.31-50.el7.noarch
    --> Processing Dependency: libxml2-python for package: yum-utils-1.1.31-50.el7.noarch
    --> Running transaction check
    ---> Package libxml2-python.x86_64 0:2.9.1-6.el7_2.3 will be installed
    ---> Package python-kitchen.noarch 0:1.1.1-5.el7 will be installed
    --> Processing Dependency: python-chardet for package: python-kitchen-1.1.1-5.el7.noarch
    --> Running transaction check
    ---> Package python-chardet.noarch 0:2.2.1-1.el7_1 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ====================================================================================================================================================================
     Package                                    Arch                               Version                                       Repository                        Size
    ====================================================================================================================================================================
    Installing:
     yum-utils                                  noarch                             1.1.31-50.el7                                 base                             121 k
    Installing for dependencies:
     libxml2-python                             x86_64                             2.9.1-6.el7_2.3                               base                             247 k
     python-chardet                             noarch                             2.2.1-1.el7_1                                 base                             227 k
     python-kitchen                             noarch                             1.1.1-5.el7                                   base                             267 k
    
    Transaction Summary
    ====================================================================================================================================================================
    Install  1 Package (+3 Dependent packages)
    
    Total download size: 861 k
    Installed size: 4.3 M
    Downloading packages:
    (1/4): libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm                                                                                             | 247 kB  00:00:01     
    (2/4): python-chardet-2.2.1-1.el7_1.noarch.rpm                                                                                               | 227 kB  00:00:02     
    (3/4): python-kitchen-1.1.1-5.el7.noarch.rpm                                                                                                 | 267 kB  00:00:00     
    (4/4): yum-utils-1.1.31-50.el7.noarch.rpm                                                                                                    | 121 kB  00:00:00     
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Total                                                                                                                               286 kB/s | 861 kB  00:00:03     
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : python-chardet-2.2.1-1.el7_1.noarch                                                                                                              1/4 
      Installing : python-kitchen-1.1.1-5.el7.noarch                                                                                                                2/4 
      Installing : libxml2-python-2.9.1-6.el7_2.3.x86_64                                                                                                            3/4 
      Installing : yum-utils-1.1.31-50.el7.noarch                                                                                                                   4/4 
      Verifying  : libxml2-python-2.9.1-6.el7_2.3.x86_64                                                                                                            1/4 
      Verifying  : python-kitchen-1.1.1-5.el7.noarch                                                                                                                2/4 
      Verifying  : yum-utils-1.1.31-50.el7.noarch                                                                                                                   3/4 
      Verifying  : python-chardet-2.2.1-1.el7_1.noarch                                                                                                              4/4 
    
    Installed:
      yum-utils.noarch 0:1.1.31-50.el7                                                                                                                                  
    
    Dependency Installed:
      libxml2-python.x86_64 0:2.9.1-6.el7_2.3                 python-chardet.noarch 0:2.2.1-1.el7_1                 python-kitchen.noarch 0:1.1.1-5.el7                
    
    Complete!
    Loaded plugins: fastestmirror
    adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
    grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
    repo saved to /etc/yum.repos.d/docker-ce.repo
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    docker-ce-stable                                                                                                                             | 3.5 kB  00:00:00     
    (1/2): docker-ce-stable/x86_64/updateinfo                                                                                                    |   55 B  00:00:13     
    (2/2): docker-ce-stable/x86_64/primary_db                                                                                                    |  28 kB  00:00:14     
    Resolving Dependencies
    --> Running transaction check
    ---> Package containerd.io.x86_64 0:1.2.5-3.1.el7 will be installed
    ---> Package docker-ce.x86_64 3:18.09.6-3.el7 will be installed
    --> Processing Dependency: container-selinux >= 2.9 for package: 3:docker-ce-18.09.6-3.el7.x86_64
    --> Processing Dependency: libseccomp >= 2.3 for package: 3:docker-ce-18.09.6-3.el7.x86_64
    --> Processing Dependency: libcgroup for package: 3:docker-ce-18.09.6-3.el7.x86_64
    --> Processing Dependency: libseccomp.so.2()(64bit) for package: 3:docker-ce-18.09.6-3.el7.x86_64
    ---> Package docker-ce-cli.x86_64 1:18.09.6-3.el7 will be installed
    --> Running transaction check
    ---> Package container-selinux.noarch 2:2.95-2.el7_6 will be installed
    --> Processing Dependency: policycoreutils-python for package: 2:container-selinux-2.95-2.el7_6.noarch
    ---> Package libcgroup.x86_64 0:0.41-20.el7 will be installed
    ---> Package libseccomp.x86_64 0:2.3.1-3.el7 will be installed
    --> Running transaction check
    ---> Package policycoreutils-python.x86_64 0:2.5-29.el7_6.1 will be installed
    --> Processing Dependency: setools-libs >= 3.3.8-4 for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
    --> Processing Dependency: libsemanage-python >= 2.5-14 for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
    --> Processing Dependency: audit-libs-python >= 2.1.3-4 for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
    --> Processing Dependency: python-IPy for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
    --> Processing Dependency: libqpol.so.1(VERS_1.4)(64bit) for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
    --> Processing Dependency: libqpol.so.1(VERS_1.2)(64bit) for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
    --> Processing Dependency: libapol.so.4(VERS_4.0)(64bit) for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
    --> Processing Dependency: checkpolicy for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
    --> Processing Dependency: libqpol.so.1()(64bit) for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
    --> Processing Dependency: libapol.so.4()(64bit) for package: policycoreutils-python-2.5-29.el7_6.1.x86_64
    --> Running transaction check
    ---> Package audit-libs-python.x86_64 0:2.8.4-4.el7 will be installed
    ---> Package checkpolicy.x86_64 0:2.5-8.el7 will be installed
    ---> Package libsemanage-python.x86_64 0:2.5-14.el7 will be installed
    ---> Package python-IPy.noarch 0:0.75-6.el7 will be installed
    ---> Package setools-libs.x86_64 0:3.3.8-4.el7 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ====================================================================================================================================================================
     Package                                       Arch                          Version                                  Repository                               Size
    ====================================================================================================================================================================
    Installing:
     containerd.io                                 x86_64                        1.2.5-3.1.el7                            docker-ce-stable                         22 M
     docker-ce                                     x86_64                        3:18.09.6-3.el7                          docker-ce-stable                         19 M
     docker-ce-cli                                 x86_64                        1:18.09.6-3.el7                          docker-ce-stable                         14 M
    Installing for dependencies:
     audit-libs-python                             x86_64                        2.8.4-4.el7                              base                                     76 k
     checkpolicy                                   x86_64                        2.5-8.el7                                base                                    295 k
     container-selinux                             noarch                        2:2.95-2.el7_6                           extras                                   39 k
     libcgroup                                     x86_64                        0.41-20.el7                              base                                     66 k
     libseccomp                                    x86_64                        2.3.1-3.el7                              base                                     56 k
     libsemanage-python                            x86_64                        2.5-14.el7                               base                                    113 k
     policycoreutils-python                        x86_64                        2.5-29.el7_6.1                           updates                                 456 k
     python-IPy                                    noarch                        0.75-6.el7                               base                                     32 k
     setools-libs                                  x86_64                        3.3.8-4.el7                              base                                    620 k
    
    Transaction Summary
    ====================================================================================================================================================================
    Install  3 Packages (+9 Dependent packages)
    
    Total download size: 57 M
    Installed size: 241 M
    Is this ok [y/d/N]: y
    Downloading packages:
    (1/12): container-selinux-2.95-2.el7_6.noarch.rpm                                                                                            |  39 kB  00:00:01     
    (2/12): checkpolicy-2.5-8.el7.x86_64.rpm                                                                                                     | 295 kB  00:00:01     
    (3/12): audit-libs-python-2.8.4-4.el7.x86_64.rpm                                                                                             |  76 kB  00:00:02     
    containerd.io-1.2.5-3.1.el7.x8 FAILED                                          ======-                                            ] 234 kB/s |  13 MB  00:03:11 ETA 
    https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.5-3.1.el7.x86_64.rpm: [Errno 12] Timeout on https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.5-3.1.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
    Trying other mirror.
    (4/12): libcgroup-0.41-20.el7.x86_64.rpm                                                                                                     |  66 kB  00:00:00     
    (5/12): libsemanage-python-2.5-14.el7.x86_64.rpm                                                                                             | 113 kB  00:00:00     
    (6/12): python-IPy-0.75-6.el7.noarch.rpm                                                                                                     |  32 kB  00:00:00     
    (7/12): setools-libs-3.3.8-4.el7.x86_64.rpm                                                                                                  | 620 kB  00:00:01     
    (8/12): libseccomp-2.3.1-3.el7.x86_64.rpm                                                                                                    |  56 kB  00:00:01     
    (9/12): policycoreutils-python-2.5-29.el7_6.1.x86_64.rpm                                                                                     | 456 kB  00:00:02     
    warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/docker-ce-18.09.6-3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY  00:01:13 ETA 
    Public key for docker-ce-18.09.6-3.el7.x86_64.rpm is not installed
    (10/12): docker-ce-18.09.6-3.el7.x86_64.rpm                                                                                                  |  19 MB  00:01:35     
    docker-ce-cli-18.09.6-3.el7.x8 FAILED                                          ===========================-                       ]  187 B/s |  34 MB  35:40:50 ETA 
    https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-cli-18.09.6-3.el7.x86_64.rpm: [Errno 12] Timeout on https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-cli-18.09.6-3.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
    Trying other mirror.
    (11/12): containerd.io-1.2.5-3.1.el7.x86_64.rpm                                                                                              |  22 MB  00:01:17     
    (12/12): docker-ce-cli-18.09.6-3.el7.x86_64.rpm                                                                                              |  14 MB  00:00:02     
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Total                                                                                                                               246 kB/s |  57 MB  00:03:55     
    Retrieving key from https://download.docker.com/linux/centos/gpg
    Importing GPG key 0x621E9F35:
     Userid     : "Docker Release (CE rpm) <docker@docker.com>"
     Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
     From       : https://download.docker.com/linux/centos/gpg
    Is this ok [y/N]: y
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : libcgroup-0.41-20.el7.x86_64                                                                                                                    1/12 
      Installing : setools-libs-3.3.8-4.el7.x86_64                                                                                                                 2/12 
      Installing : audit-libs-python-2.8.4-4.el7.x86_64                                                                                                            3/12 
      Installing : checkpolicy-2.5-8.el7.x86_64                                                                                                                    4/12 
      Installing : libseccomp-2.3.1-3.el7.x86_64                                                                                                                   5/12 
      Installing : 1:docker-ce-cli-18.09.6-3.el7.x86_64                                                                                                            6/12 
      Installing : libsemanage-python-2.5-14.el7.x86_64                                                                                                            7/12 
      Installing : python-IPy-0.75-6.el7.noarch                                                                                                                    8/12 
      Installing : policycoreutils-python-2.5-29.el7_6.1.x86_64                                                                                                    9/12 
      Installing : 2:container-selinux-2.95-2.el7_6.noarch                                                                                                        10/12 
      Installing : containerd.io-1.2.5-3.1.el7.x86_64                                                                                                             11/12 
      Installing : 3:docker-ce-18.09.6-3.el7.x86_64                                                                                                               12/12 
      Verifying  : 2:container-selinux-2.95-2.el7_6.noarch                                                                                                         1/12 
      Verifying  : libcgroup-0.41-20.el7.x86_64                                                                                                                    2/12 
      Verifying  : containerd.io-1.2.5-3.1.el7.x86_64                                                                                                              3/12 
      Verifying  : policycoreutils-python-2.5-29.el7_6.1.x86_64                                                                                                    4/12 
      Verifying  : python-IPy-0.75-6.el7.noarch                                                                                                                    5/12 
      Verifying  : libsemanage-python-2.5-14.el7.x86_64                                                                                                            6/12 
      Verifying  : 1:docker-ce-cli-18.09.6-3.el7.x86_64                                                                                                            7/12 
      Verifying  : libseccomp-2.3.1-3.el7.x86_64                                                                                                                   8/12 
      Verifying  : checkpolicy-2.5-8.el7.x86_64                                                                                                                    9/12 
      Verifying  : 3:docker-ce-18.09.6-3.el7.x86_64                                                                                                               10/12 
      Verifying  : audit-libs-python-2.8.4-4.el7.x86_64                                                                                                           11/12 
      Verifying  : setools-libs-3.3.8-4.el7.x86_64                                                                                                                12/12 
    
    Installed:
      containerd.io.x86_64 0:1.2.5-3.1.el7                   docker-ce.x86_64 3:18.09.6-3.el7                   docker-ce-cli.x86_64 1:18.09.6-3.el7                  
    
    Dependency Installed:
      audit-libs-python.x86_64 0:2.8.4-4.el7  checkpolicy.x86_64 0:2.5-8.el7          container-selinux.noarch 2:2.95-2.el7_6         libcgroup.x86_64 0:0.41-20.el7 
      libseccomp.x86_64 0:2.3.1-3.el7         libsemanage-python.x86_64 0:2.5-14.el7  policycoreutils-python.x86_64 0:2.5-29.el7_6.1  python-IPy.noarch 0:0.75-6.el7 
      setools-libs.x86_64 0:3.3.8-4.el7      
    
    Complete!
    [sudo] password for master: 
    
  • 相关阅读:
    金山快盘的登录提醒
    排列到随机, 到随机选择,对于植物模拟世界 混沌
    转载 多层影藏 和显示
    庆生写的东西
    布料修改器的用法。
    像素相关
    模拟c++ 控件
    侧his
    输出文件
    win7 xp 删除一些 顽固的自动项目
  • 原文地址:https://www.cnblogs.com/linga/p/11033233.html
Copyright © 2011-2022 走看看