zoukankan      html  css  js  c++  java
  • 基于centos的docker安装

    1. 安装需求

    • 内核版本3.10以上
    • Centos 7以上
    • 64位版本

    2. 使用root登录或者具有sudo权限

    3. 确保系统是最新的

     yum update

    4. 添加yum源

    tee /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

    5. 安装docker包

    yum install docker-engine

    6. 开启docker服务

    service docker start

    7. 验证安装

    docker run hello-world

    输出如下

    Unable to find image 'hello-world:latest' locally
    latest: Pulling from library/hello-world
    c04b14da8d14: Pull complete 
    Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9
    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/engine/userguide/

    8. 创建docker组(可选)

    docker命令必须root权限执行,但docker用户组默认拥有这个权限

    groupadd docker
    usermod -aG docker your_username

    docker组的用户默认可执行docker命令,无需root权限

    9. 启动时运行docker服务(可选)

    chkconfig docker on

    10. 卸载docker

    查看安装docker包

    $ yum list installed | grep docker
    docker-engine.x86_64             1.11.2-1.el7.centos                 @dockerrepo
    docker-engine-selinux.noarch     1.11.2-1.el7.centos                 @dockerrepo

    删除安装的包

    yum -y remove docker-engine.x86_64

    这一步并未删除数据,要想删除镜像、容器和磁盘卷,执行如下命令

    rm -rf /var/lib/docker
  • 相关阅读:
    ubuntu(14.4) 安装phpmyadmin
    ubuntu(14.04) 安装ssh,并使用root用户登录
    ubuntu(14.04版本) 配置虚拟环境(一个ip对应多个域名)
    ubuntu 中数据的迁移
    ubuntu修改固定ip
    作业调度框架_Quartz
    tomcat设置端口号和默认webapp
    HTTP深入浅出 http请求
    HTTP协议详解
    如何准备阿里社招面试,顺谈 Java 程序员学习中各阶段的建议【转】
  • 原文地址:https://www.cnblogs.com/osroot/p/5691695.html
Copyright © 2011-2022 走看看