美文网首页
CentOS 7 中 Docker 的安装

CentOS 7 中 Docker 的安装

作者: liurongming | 来源:发表于2017-12-17 10:20 被阅读0次

    前提条件:

    Docker目前可以在红帽企业版7(Red Hat Enterprise Linux 7)版本下面安装。
    依赖性检查:

    Docker需要一个64位系统的红帽系统,内核的版本必须大于3.10。可以用下面的命令来检查是否满足docker的要求。
    $ uname -r 3.10.0-229.el7.x86_64 
    如果上述的依赖满足的话,还是推荐您全面地更新红帽系统,以保证内核相应的bug都得到修复
    

    CentOS 7 中 检查前提条件是否符合

    [root@iZ23zw6sa1kZ ~]# uname -r
    3.10.0-514.10.2.el7.x86_64
    [root@iZ23zw6sa1kZ ~]# 
    

    CentOS 7 中 Docker 的安装

    Docker 软件包已经包括在默认的 CentOS-Extras 软件源里。因此想要安装 docker,只需要运行下面的 yum 命令:

    [root@localhost ~]# yum install docker
    

    启动 Docker 服务
    安装完成后,使用下面的命令来启动 docker 服务,并将其设置为开机启动:

    [root@localhost ~]# service docker start
    [root@localhost ~]# chkconfig docker on
    

    (LCTT 译注:此处采用了旧式的 sysv 语法,如采用CentOS 7中支持的新式 systemd 语法,如下:

    [root@localhost ~]# systemctl start docker.service
    [root@localhost ~]# systemctl enable docker.service
    

    检验是否安装成功

    安装成功界面如下:

    [root@iZ23zw6sa1kZ ~]# 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://cloud.docker.com/
    
    For more examples and ideas, visit:
     https://docs.docker.com/engine/userguide/
    
    [root@iZ23zw6sa1kZ ~]# 
    

    至此,centos7的docker 安装完毕!

    修改国内镜像

    疯狂提速

    $ vi /etc/docker/daemon.json
    {"registry-mirrors": ["http://hub-mirror.c.163.com"]}
    
    { 
    "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"] 
    }
    

    相关文章

      网友评论

          本文标题:CentOS 7 中 Docker 的安装

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