添加阿里云的 Docker 仓库:

[root@k8s-m-eca ~]# yum install https://mirrors.aliyun.com/docker-ce/linux/centos/7/x86_64/stable/Packages/docker-ce-17.09.1.ce-1.el7.centos.x86_64.rpm

# 配置加速器
vim /etc/docker/daemon.json

{
  "registry-mirrors":
      ["http://xxxxxx.mirror.aliyuncs.com", "http://xxxxxxx.m.daocloud.io"],
     "storage-driver": "devicemapper"
}

或者

http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

[root@k8s-m-eca ~]# wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo 

[root@k8s-m-eca ~]# yum makecache

安装 Docker

[root@k8s-m-eca ~]# yum install docker-ce -y

[root@k8s-m-eca ~]# docker version 
Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        e68fc7a
 Built:             Tue Aug 21 17:23:03 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       e68fc7a
  Built:            Tue Aug 21 17:25:29 2018
  OS/Arch:          linux/amd64
  Experimental:     false

启动 Docker 服务并激活开机启动

Systemd – docker 配置文件 /usr/lib/systemd/system/docker.service

ExecStart=/usr/bin/dockerd –bip=172.21.0.1/16 –graph=/apps/docker_data
Options: https://docs.docker.com/engine/reference/commandline/dockerd/#options-per-storage-driver

[root@k8s-m-eca ~]# systemctl daemon-reload && systemctl start docker && systemctl enable docker