zoukankan      html  css  js  c++  java
  • Centos7 安装 docker-ce

    本文参考官网地址:https://docs.docker.com/install/linux/docker-ce/centos/#os-requirements

    1、卸载旧版本的docker

    $ sudo yum remove docker 
                      docker-client 
                      docker-client-latest 
                      docker-common 
                      docker-latest 
                      docker-latest-logrotate 
                      docker-logrotate 
                      docker-selinux 
                      docker-engine-selinux 
                      docker-engine

    2、安装依赖的工具

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

    yum-utils 提供了 yum-config-manager 功能,该功能后边会用到

    device-mapper-persistent-data 和lvm2 是 devicemapper所需的依赖,devicemapper可以理解为一种docker用来存放容器和镜像的技术。

    3、添加docker yum源,这时用到了 yum-config-manager

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

    4、开启刚才下载的yum源

    $ sudo yum-config-manager --enable docker-ce-edge
    $ sudo yum-config-manager --enable docker-ce-test

    第三步下载下来的repo中已经包含了edge 和 test 仓库,但是默认是关闭的,所以需要我们手动开启,我们也可以用下边的命令来关闭它们

    $ sudo yum-config-manager --disable docker-ce-edge

    5、安装docker

    你可以通过以下命令安装最新版的docker:

    $ sudo yum install docker-ce

    也可以挑选一个特定的版本:

    先列出所有可选版本

    [root@MiWiFi-R3L-srv proc]# yum list docker-ce --showduplicates | sort -r

    Repodata is over
    2 weeks old. Install yum-cron? Or run: yum makecache fast * updates: mirrors.163.com Loaded plugins: fastestmirror Installed Packages * extras: mirrors.cn99.com docker-ce.x86_64 17.12.0.ce-1.el7.centos docker-ce-stable docker-ce.x86_64 17.09.1.ce-1.el7.centos docker-ce-stable docker-ce.x86_64 17.09.0.ce-1.el7.centos installed docker-ce.x86_64 17.09.0.ce-1.el7.centos docker-ce-stable docker-ce.x86_64 17.06.2.ce-1.el7.centos docker-ce-stable docker-ce.x86_64 17.06.1.ce-1.el7.centos docker-ce-stable docker-ce.x86_64 17.06.0.ce-1.el7.centos docker-ce-stable docker-ce.x86_64 17.03.2.ce-1.el7.centos docker-ce-stable docker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stable docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable

    如上文,已经列出了可用版本,我们选择所需要的版本,列表中第二列是版本号,第三列是package名

    这里需要拼一下软件名,使用图中标红位置的字符串“docker-ce”和“17.09.1.ce”,再加上一个“-”,即可拼成。

    比如我们要装17.09.1版的,那么软件名就是docker-ce-17.09.1.ce

    官网原文(嘟嘟嘟一堆,又是可以使用全名,又是至少要到什么位置……不看也罢):

    The contents of the list depend upon which repositories are enabled, and are specific to your version of
    CentOS (indicated by the .el7 suffix on the version, in this example). Choose a specific version to install.
    The second column is the version string. You can use the entire version string, but you need to include at least to the first hyphen.
    The third column is the repository name, which indicates which repository the package is from and by extension its stability level.
    To install a specific version, append the version string to the package name and separate them by a hyphen (-).
    $ sudo yum install <你刚才拼出来的名称>

    6、开启docker守护线程(服务端)

    $ sudo systemctl start docker

    7、跑个image试一下

    $ sudo docker run hello-world
  • 相关阅读:
    python 特性 property
    OWASP_ZAP集成渗透测试和漏洞工具
    openvas开放式漏洞评估系统
    SSL协议(安全套接层协议)
    windows下如何查看端口,关闭端口,开启端口
    网络端口通俗的说是啥意思?
    APP安全性测试总结--网上转载
    android填满手机内存的方法
    adb push和adb install区别
    Maven打包同一个jar有不同的:版本+时间戳(解决思路)
  • 原文地址:https://www.cnblogs.com/flying607/p/8559702.html
Copyright © 2011-2022 走看看