美文网首页
CentOS Docker(Community Edition)

CentOS Docker(Community Edition)

作者: zlchen | 来源:发表于2020-05-31 09:23 被阅读0次

    Docker 从 17.03 版本之后分为 CE(Community Edition: 社区版) 和 EE(Enterprise Edition: 企业版)

    安装所需的软件包。yum-utils 提供了 yum-config-manager ,并且 device mapper 存储驱动程序需要 device-mapper-persistent-data 和 lvm2。
    [root@VM_0_11_centos ~]$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
    
    设置稳定的仓库

    1、docker官方仓库

    [root@VM_0_11_centos ~]$ sudo yum-config-manager  --add-repo https://download.docker.com/linux/centos/docker-ce.repo
    

    2、或者使用阿里云的仓库

    [root@VM_0_11_centos ~]$ sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    
    安装 Docker Engine-Community

    1、安装最新版本的 Docker Engine-Community 和 containerd

    [root@VM_0_11_centos ~]$ sudo yum install docker-ce docker-ce-cli containerd.io
    

    2、安装特定版本的 Docker Engine-Community
    列出并排序您存储库中可用的版本。此示例按版本号(从高到低)对结果进行排序。

    [root@VM_0_11_centos ~]$ sudo yum list docker-ce --showduplicates | sort -r
    Repository epel is listed more than once in the configuration
     * webtatic: us-east.repo.webtatic.com
    Loading mirror speeds from cached hostfile
    Loaded plugins: fastestmirror, langpacks
    Installed Packages
    docker-ce.x86_64            3:19.03.9-3.el7                    docker-ce-stable
    docker-ce.x86_64            3:19.03.8-3.el7                    docker-ce-stable
    docker-ce.x86_64            3:19.03.8-3.el7                    @docker-ce-stable
    docker-ce.x86_64            3:19.03.7-3.el7                    docker-ce-stable
    docker-ce.x86_64            3:19.03.6-3.el7                    docker-ce-stable
    docker-ce.x86_64            3:19.03.5-3.el7                    docker-ce-stable
    docker-ce.x86_64            3:19.03.4-3.el7                    docker-ce-stable
    docker-ce.x86_64            3:19.03.3-3.el7                    docker-ce-stable
    docker-ce.x86_64            3:19.03.2-3.el7                    docker-ce-stable
    docker-ce.x86_64            3:19.03.1-3.el7                    docker-ce-stable
    docker-ce.x86_64            3:19.03.0-3.el7                    docker-ce-stable
    docker-ce.x86_64            3:18.09.9-3.el7                    docker-ce-stable
    docker-ce.x86_64            3:18.09.8-3.el7                    docker-ce-stable
    docker-ce.x86_64            3:18.09.7-3.el7                    docker-ce-stable
    docker-ce.x86_64            3:18.09.6-3.el7                    docker-ce-stable
    docker-ce.x86_64            3:18.09.5-3.el7                    docker-ce-stable
    docker-ce.x86_64            3:18.09.4-3.el7                    docker-ce-stable
    docker-ce.x86_64            3:18.09.3-3.el7                    docker-ce-stable
    docker-ce.x86_64            3:18.09.2-3.el7                    docker-ce-stable
    docker-ce.x86_64            3:18.09.1-3.el7                    docker-ce-stable
    docker-ce.x86_64            3:18.09.0-3.el7                    docker-ce-stable
    docker-ce.x86_64            18.06.3.ce-3.el7                   docker-ce-stable
    docker-ce.x86_64            18.06.2.ce-3.el7                   docker-ce-stable
    docker-ce.x86_64            18.06.1.ce-3.el7                   docker-ce-stable
    docker-ce.x86_64            18.06.0.ce-3.el7                   docker-ce-stable
    docker-ce.x86_64            18.03.1.ce-1.el7.centos            docker-ce-stable
    docker-ce.x86_64            18.03.0.ce-1.el7.centos            docker-ce-stable
    docker-ce.x86_64            17.12.1.ce-1.el7.centos            docker-ce-stable
    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            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.3.ce-1.el7                   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
    Available Packages
    

    通过其完整的软件包名称安装特定版本,该软件包名称是软件包名称(docker-ce)加上版本字符串(第二列),从第一个冒号(:)一直到第一个连字符,并用连字符(-)分隔。例如:docker-ce-18.09.1。

    [root@VM_0_11_centos ~]$ sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
    
    启动 Docker
    [root@VM_0_11_centos ~]$ sudo systemctl start docker
    
    设置Docker开机自启动
    [root@VM_0_11_centos ~]$ sudo systemctl enable docker
    
    通过运行 hello-world 映像来验证是否正确安装了 Docker Engine-Community
    [root@VM_0_11_centos ~]$ sudo docker run hello-world
    
    Hello from Docker!
    This message shows that your installation appears to be working correctly.
    
    To generate this message, Docker took the following steps:
     1. The Docker client contacted the Docker daemon.
     2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
        (amd64)
     3. The Docker daemon created a new container from that image which runs the
        executable that produces the output you are currently reading.
     4. The Docker daemon streamed that output to the Docker client, which sent it
        to your terminal.
    
    To try something more ambitious, you can run an Ubuntu container with:
     $ docker run -it ubuntu bash
    
    Share images, automate workflows, and more with a free Docker ID:
     https://hub.docker.com/
    
    For more examples and ideas, visit:
     https://docs.docker.com/get-started/
    
    

    相关文章

      网友评论

          本文标题:CentOS Docker(Community Edition)

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