暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Docker的安装

运维小菜鸡 2019-05-13
184

Docker官方安装文档:https://docs.docker.com/install/


1、Docker版本


社区版(Community Edition, CE)

    开源免费使用,一般个人和企业没有特殊需求的话都会选择该版本使用。

企业版(Enterprise Edition, EE)

    收费,但是提供了很多的商业技术支持,比社区版更加新的功能。


2、Docker的安装

    

    Mac安装Docker:https://docs.docker.com/docker-for-mac/install/

    Windows安装Docker(注意需要win10):https://docs.docker.com/docker-for-windows/install/

    CentOS安装Docker:https://docs.docker.com/install/linux/docker-ce/centos/

    Ubuntu安装Docker:https://docs.docker.com/install/linux/docker-ce/ubuntu/

    Debian安装Docker:https://docs.docker.com/install/linux/docker-ce/debian/

    Fedora安装Docker:https://docs.docker.com/install/linux/docker-ce/fedora/


以CentOS7为例安装Docker CE


1. 首先确保之前没有安装过或者已经完全删除了其他版本的Docker

    # 如果有安装其他版本的docker需要先卸载
    sudo yum remove -y docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine


    # 卸载完成之后删掉docker对应的存放路径
    rm -rf var/lib/docker/


    2. 安装依赖包

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


      3. 添加官方yum源

        # docker官方的yum源在国内可能有些人的网络无法访问,可以采用国内的一些yum源,自行百度即可
        sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo


        4. 安装docker-ce

          sudo yum install -y docker-ce docker-ce-cli containerd.io


          5. 启动Docker服务并设置开机自启

            systemctl start docker.service
            systemctl enable docker.service


            6. 检查是否能够正常使用docker

              [root@docker ~]# 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/
              [root@docker ~]#


              至此,Docker就已经安装到你的服务器上了!

              文章转载自运维小菜鸡,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

              评论