美文网首页应用
Linux系统安装官网Docker的方法

Linux系统安装官网Docker的方法

作者: 陈洪华 | 来源:发表于2020-10-02 12:55 被阅读0次

    一、Centos

    1.安装yum拓展工具

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

    2.添加官网docker源

    yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
    yum-config-manager --enable docker-ce-edge
    

    rpm包下载地址:https://download.docker.com/linux/centos/7/x86_64/stable/Packages/

    3.查看软件版本

    yum list docker-ce --showduplicates | sort -r
    

    4.安装指定的版本

    # 选择指定版本安装
    yum install -y docker-ce-18.06.1.ce-3.el7 docker-ce-cli-18.06.1.ce-3.el7 containerd.io docker-compose
    # 不想或不知道如何选择选择版本的,可以直接使用下面的命令安装官方仓库中最新的版本
    yum install -y docker-ce docker-ce-cli containerd.io docker-compose
    

    5.设置开机启动

    安装完成后,如果嫌每次开机需要手动启动docker太麻烦,就可以使用下列命令设置开机启动

    systemctl enable docker
    systemctl start docker
    

    6.包清单

    如果想要进行离线安装的,可以在下面的安装记录,找到对应的安装包

    Dependencies Resolved
    
    =================================================================================================================================================================================================================================
     Package                                                       Arch                                       Version                                                       Repository                                          Size
    =================================================================================================================================================================================================================================
    Installing:
     containerd.io                                                 x86_64                                     1.2.13-3.2.el7                                                docker-ce-edge                                      25 M
     docker-ce                                                     x86_64                                     18.06.1.ce-3.el7                                              docker-ce-edge                                      41 M
     docker-compose                                                noarch                                     1.18.0-4.el7                                                  epel                                               222 k
    Installing for dependencies:
     audit-libs-python                                             x86_64                                     2.8.5-4.el7                                                   base                                                76 k
     checkpolicy                                                   x86_64                                     2.5-8.el7                                                     base                                               295 k
     container-selinux                                             noarch                                     2:2.119.2-1.911c772.el7_8                                     extras                                              40 k
     libcgroup                                                     x86_64                                     0.41-21.el7                                                   base                                                66 k
     libseccomp                                                    x86_64                                     2.3.1-4.el7                                                   base                                                56 k
     libsemanage-python                                            x86_64                                     2.5-14.el7                                                    base                                               113 k
     libtirpc                                                      x86_64                                     0.2.4-0.16.el7                                                base                                                89 k
     libtool-ltdl                                                  x86_64                                     2.4.2-22.el7_3                                                base                                                49 k
     libyaml                                                       x86_64                                     0.1.4-11.el7_0                                                base                                                55 k
     policycoreutils-python                                        x86_64                                     2.5-34.el7                                                    base                                               457 k
     python-IPy                                                    noarch                                     0.75-6.el7                                                    base                                                32 k
     python3                                                       x86_64                                     3.6.8-13.el7                                                  base                                                69 k
     python3-libs                                                  x86_64                                     3.6.8-13.el7                                                  base                                               7.0 M
     python3-pip                                                   noarch                                     9.0.3-7.el7_7                                                 updates                                            1.8 M
     python3-setuptools                                            noarch                                     39.2.0-10.el7                                                 base                                               629 k
     python36-PyYAML                                               x86_64                                     3.13-1.el7                                                    epel                                               149 k
     python36-cached_property                                      noarch                                     1.5.1-2.el7                                                   epel                                                18 k
     python36-chardet                                              noarch                                     3.0.4-1.el7                                                   epel                                               190 k
     python36-docker                                               noarch                                     2.6.1-3.el7                                                   epel                                               180 k
     python36-docker-pycreds                                       noarch                                     0.2.1-2.el7                                                   epel                                                15 k
     python36-dockerpty                                            noarch                                     0.4.1-18.el7                                                  epel                                                30 k
     python36-docopt                                               noarch                                     0.6.2-8.el7                                                   epel                                                29 k
     python36-idna                                                 noarch                                     2.7-2.el7                                                     epel                                                98 k
     python36-jsonschema                                           noarch                                     2.5.1-4.el7                                                   epel                                                76 k
     python36-pysocks                                              noarch                                     1.6.8-7.el7                                                   epel                                                30 k
     python36-requests                                             noarch                                     2.14.2-2.el7                                                  epel                                               112 k
     python36-six                                                  noarch                                     1.14.0-2.el7                                                  epel                                                34 k
     python36-texttable                                            noarch                                     1.6.2-1.el7                                                   epel                                                23 k
     python36-urllib3                                              noarch                                     1.25.6-1.el7                                                  epel                                               178 k
     python36-websocket-client                                     noarch                                     0.47.0-2.el7                                                  epel                                                59 k
     setools-libs                                                  x86_64                                     3.3.8-4.el7                                                   base                                               620 k
    Updating for dependencies:
     audit                                                         x86_64                                     2.8.5-4.el7                                                   base                                               256 k
     audit-libs                                                    x86_64                                     2.8.5-4.el7                                                   base                                               102 k
     libselinux                                                    x86_64                                     2.5-15.el7                                                    base                                               162 k
     libselinux-python                                             x86_64                                     2.5-15.el7                                                    base                                               236 k
     libselinux-utils                                              x86_64                                     2.5-15.el7                                                    base                                               151 k
     libsemanage                                                   x86_64                                     2.5-14.el7                                                    base                                               151 k
     libsepol                                                      x86_64                                     2.5-10.el7                                                    base                                               297 k
     policycoreutils                                               x86_64                                     2.5-34.el7                                                    base                                               917 k
     selinux-policy                                                noarch                                     3.13.1-266.el7_8.1                                            updates                                            497 k
     selinux-policy-targeted                                       noarch                                     3.13.1-266.el7_8.1                                            updates                                            7.0 M
    
    Transaction Summary
    =================================================================================================================================================================================================================================
    

    二、Debian系

    1.更新

    apt update
    

    2.安装支持工具

    apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
    

    3.下载认证

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    

    4.添加仓库数据

    # 根据不同的OS环境和网络连接情况,在下列链接中选择指定链接,也可以自行手动编辑
    # https://download.docker.com/linux/ubuntu
    # https://mirrors.ustc.edu.cn/docker-ce/linux/debian
    # 添加APT仓库等命令如下
    # add-apt-repository "deb [arch=amd64] <仓库链接>/<linux发行版名称,如ubuntu,debian等> <发行版具体大版本,如bionic,focal等> stable"
    add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
    # 添加后需要更新下仓库缓存
    apt update
    

    5.安装

    # 查看版本清单
    apt-cache madison docker-ce
    # 结果如下:
    # docker-ce | 5:18.09.1~3-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu  xenial/stable amd64 Packages
    # docker-ce | 5:18.09.0~3-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu  xenial/stable amd64 Packages
    apt install docker-ce=18.09.0 docker-ce-cli=18.09.0 containerd.io
    

    相关文章

      网友评论

        本文标题:Linux系统安装官网Docker的方法

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