• docker安装


    如何在centos7上通过yum安装docker

    144 
    作者 ppmoon 
    2015.10.03 23:40 字数 668 阅读 1973评论 0

    在centos7上我们可以通过yum来安装docker

    1.确保你拥有管理员权限,需要可以使用sudo或者root的命令的权限。

    2.需要将你的yum的包升级到最新的状态。

    sudo yum update

    3.为你的yum添加一个repo文件。在centos7下面您可以直接运行下面的代码。

    cat >/etc/yum.repos.d/docker.repo <<-EOF

    [dockerrepo]

    name=Docker Repository

    baseurl=https://yum.dockerproject.org/repo/main/centos/7

    enabled=1

    gpgcheck=1

    gpgkey=https://yum.dockerproject.org/gpg

    EOF

    在shell状态下可以直接粘贴复制。这个repo的目的就是为了让我们的yum可以根据repo文件里提供的连接去检索docker最新的安装包。

    4.使用yum命令安装docker

    sudo yum install docker-engine

    根据提示一路确认即可。安装好以后会提示类似下面的话

    Installed:

    docker-engine.x86_64 0:1.8.2-1.el7.centos

    Dependency Installed:

    libcgroup.x86_64 0:0.41-8.el7

    Complete!

    这就说明你的docker安装成功了。

    5.用下面的命令启动docker

    sudo service docker start

    如果你的centos里面没有任何镜像的话,系统会提示下面这句话。

    Starting docker (via systemctl):

    可以不用理会直接ctrl+c退出,因为没有任何镜像你的docker没有什么可以启动的。

    6.通过docker run命令自动添加一个hello world的镜像

    docker run hello-world

    运行这条命令以后docker会先去检索本地是否有以hello-world命名的镜像,如果有会直接启动,如果没有他会去docker在互联网中默认的镜像库里面寻找这个hello-word的镜像下载并安装。安装好以后会自动启动。提示如下:

    Unable to find image 'hello-world:latest' locally

    Pulling repository docker.io/library/hello-world

    af340544ed62: Download complete

    535020c3e8ad: Download complete

    Status: Downloaded newer image for hello-world:latest

    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.

    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 Hub account:

    https://hub.docker.com

    For more examples and ideas, visit:

    https://docs.docker.com/userguide/

    如果看到这样的命令就说明hello-world的镜像安装好了。

    这个时候我们再键入

    service docker start

    就会提示

    Starting docker (via systemctl):                          [  OK  ]

    说明我们的docker已经正常的在centos上运行了。

     docker

    如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

    赞赏支持
    登录 后发表评论
    评论
     
    智慧如你,不想发表一点想法咩~
     
  • 相关阅读:
    异常解决:swagger2.9.2 报java.lang.NumberFormatException: For input string: ““...
    SpringBoot中使用热部署插件
    SpringBoot中使用自定义拦截器
    SpringBoot开发的接口实现RESTFull的设计风格
    SpringBoot中使用jsp页面的方法
    SpringBoot的自定义配置方法二,通过@Value注解
    SpringBoot的自定义配置方法一,通过自定义配置文件
    Eclipse中使用Mybatis Generator自动生成POJO类、mapper类等
    Eclipse中将Maven工程转成SpringBoot工程
    相对高效的遍历Map的方法,其他方法效率相对较低
  • 原文地址:https://www.cnblogs.com/lupeng2010/p/6520109.html
Copyright © 2020-2023  润新知