docker 安装

Ubuntu16.04下安装

1. 安装 使系统支持 https 协议的源 的软件包

    apt-get update

    apt-get install apt-transport-https ca-certificates curl software-properties-common

2. 添加 源 的 gpg密钥

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -

3. 添加 Docker 官方稳定版 的源

    add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable"

    apt-get update

4. 安装docker

    软件包的名称为 docker-ce (ce 为社区版本!)

    apt -y install docker-ce

5. 查看版本

    docker -v

centos和redhat上安装docker

1. 卸载旧版本

    yum remove docker docker-common  docker-selinux  docker-engine

2. 安装需要的软件包

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

3. 设置yum源

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

4. 安装docker

    yum install -y docker-ce

启动docker:  systemctl start docker.service

参考文档:

https://blog.csdn.net/ljlfather/article/details/105444120

https://www.cnblogs.com/404code/p/10706365.html

原文地址:https://www.cnblogs.com/yu121/p/13523311.html