美文网首页
【docker】centos 7 安装 docker

【docker】centos 7 安装 docker

作者: miniy_7 | 来源:发表于2020-06-16 14:41 被阅读0次

    使用官方安装脚本自动安装

    • 安装命令
    # 方式一 使用官方地址
    curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
    # 方式二 使用国内 daocloud 安装
    curl -sSL https://get.daocloud.io/docker | sh
    

    手动安装

    • 卸载原有旧版本
    sudo yum remove docker \
                      docker-client \
                      docker-client-latest \
                      docker-common \
                      docker-latest \
                      docker-latest-logrotate \
                      docker-logrotate \
                      docker-engine
    
    • 设置docker 仓库
    # 安装必须的软件
    sudo yum install -y yum-utils \
      device-mapper-persistent-data \
      lvm2
    # 设置 官方仓库 (比较慢)
    sudo yum-config-manager \
        --add-repo \
        https://download.docker.com/linux/centos/docker-ce.repo
    # 阿里云 仓库  
    sudo yum-config-manager \
        --add-repo \
        http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    
    # 清华大学 仓库
    sudo yum-config-manager \
        --add-repo \
        https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo
    
    
    • 安装最新版 Docker Engine-Community
    sudo yum install docker-ce docker-ce-cli containerd.io
    
    • 启动 docker
    sudo systemctl start docker
    
    • 验证docker ,通过运行 hello-world 验证
    sudo docker run hello-world
    

    相关文章

      网友评论

          本文标题:【docker】centos 7 安装 docker

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