官方文档: https://docs.docker.com/install/linux/docker-ce/centos/

1. 确认系统版本

  1. cat /etc/redhat-release

2. 安装 gcc 依赖

  1. yum install -y gcc
  2. yum -y install gcc-c++

3.卸载旧版本

  1. yum -y remove docker docker-common docker-selinux docker-engine

4.安装所需的依赖

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

5.设置stable镜像仓库

  1. yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

6. 更新yum

  1. yum makecache fast

7. 安装docker-ce

  1. yum -y install docker-ce

8. 启动Docker

  1. systemctl start docker

9.测试Docker

  1. docker version
  2. docker run hello-world