• 在centos7上安装Docker CE


    Docker CE的基本安装

    https://docs.docker.com/engine/installation/linux/docker-ce/centos/

    一、系统要求

    1、安装Docker CE,需要一个维护版本的Centos7

    2、centos-extras库必须启用,这个存储库默认启用,但是如果您禁用了它,您需要重新启用它(https://wiki.centos.org/AdditionalResources/Repositories)

    二、卸载旧版本

    yum remove docker docker-common docker-selinux

    三、安装Docker CE

    1、使用仓库安装

    1)安装需要的依赖包

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

    2)配置稳定仓库

    yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

    3)安装

    yum install docker-ce

    4)安装指定版本的Docker

    [root@docker ~]# yum list docker-ce --showduplicates | sort -r
     * updates: mirrors.aliyun.com
    Loading mirror speeds from cached hostfile
    Loaded plugins: fastestmirror
    Installed Packages
     * extras: mirrors.aliyun.com
    docker-ce.x86_64            17.09.0.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.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 
     * base: mirrors.aliyun.com
    Available Packages
    
    [root@docker ~]# yum install docker-ce-17.06.0.ce-1.el7.centos.x86_64

    5)启动docker

    systemctl start docker

    5)验证docker是否安装正确

    docker run hello-world

    2、使用rpm包安装docker

    1)稳定版下载地址:

    https://download.docker.com/linux/centos/7/x86_64/stable/Packages/

    2)安装

    yum install -y /path/to/package.rpm

    3)启动

    systemctl start docker

    4)版本升级

    yum -y upgrade  /path/to/package.rpm

    3、使用已有脚本安装

    curl -fsSL get.docker.com -o get-docker.sh
    sh get-docker.sh

    4、配置Docker开机自启动

    systemctl enable docker

    四、卸载Docker CE

    卸载docker-ce

    yum remove docker-ce

    在您的主机上的镜像、容器、卷或自定义配置文件不会自动删除,要删除所有图像、容器和卷:

    rm -rf /var/lib/docker

     

    Linux安装后的步骤

    https://docs.docker.com/engine/installation/linux/linux-postinstall/

    一、使用非root用户管理Docker

    1、创建docker群组

    groupadd docker

    2、添加需要管理docker的非root用户到docker群组

    usermod -aG docker $USER

     

    故障排除

    https://docs.docker.com/engine/installation/linux/linux-postinstall/#troubleshooting

    1、内核兼容性

    如果您的内核版本3.10小,或者缺少一些模块,Docker将无法正常运行。为了检查内核兼容性,您可以下载并运行check-compatibility.sh脚本

    curl https://raw.githubusercontent.com/docker/docker/master/contrib/check-config.sh > check-config.sh
    
    bash ./check-config.sh

    2、无法连接到docker deamon

    要查看您的docker客户端主机配置的是连接哪个主机,请检查您环境中DOCKER_HOST变量的值。

    env | grep DOCKER_HOST

    如果这个命令返回一个值,那么Docker客户端主机被设置为连接到运行在那台主机上的Docker守护进程。如果未设置,则Docker客户端被连接到运行在本地主机上的Docker守护进程。如果设置错误,请使用以下命令取消设置:

    unset DOCKER_HOST

     

     
     
  • 相关阅读:
    poj_3923Ugly Windows
    背包问题九讲笔记_01背包
    素数环
    全排列的STL实现
    [1424] 金克拉与贪吃蛇的故事
    hdoj_1548A strange lift
    iBATIS缓存配置详解
    jQuery的一些特性和用法:
    当iBATIS出项某个列不存在的问题
    当iBATIS出项某个列不存在的问题
  • 原文地址:https://www.cnblogs.com/jmaly/p/7722863.html
Copyright © 2020-2023  润新知