一、配置yum源,安装docker

[root@docker yum.repos.d]# pwd
/etc/yum.repos.d
[root@docker yum.repos.d]# wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[root@docker yum.repos.d]# cd 
[root@docker ~]# yum makecache
[root@docker ~]# yum repolist
                      .....................................
docker-ce-stable/x86_64                        Docker CE Stable - x86_64                             79
#确认docker.....这一列有可用的包,我这里显示的是79个(多点少点没关系,但一定要有这一列,并且不能为0)
[root@docker ~]# yum install -y docker-ce-18.09.0-3.el7 docker-ce-cli-18.09.0-3.el7 containerd.io-1.2.0-3.el7            # yum安装docker

containerd相关解释

若centos是最小化安装,则需要执行以下命令,以便支持Docker命令自动补全

[root@docker1 ~]# yum -y install bash-completion
[root@docker1~]# curl -L https://raw.githubusercontent.com/docker/compose/1.24.1/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
[root@docker1 ~]# source /etc/bash_completion.d/docker-compose

二、启用下载镜像的加速功能
接下来启用道云提供的下载镜像加速功能
道云加速器网址

流程如下:
(1)访问道云的官网;
(2)注册用户并且登录;

部署 Docker 及配置_第1张图片
看到如下界面后往下翻
部署 Docker 及配置_第2张图片
部署 Docker 及配置_第3张图片

[root@docker ~]# curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
docker version >= 1.12
{"registry-mirrors": ["http://f1361db2.m.daocloud.io"]}
Success.
You need to restart docker to take effect: sudo systemctl restart docker 
[root@docker ~]# systemctl daemon-reload 
[root@docker ~]# systemctl restart docker
[root@docker ~]# systemctl enable docker
[root@docker ~]# cat /etc/docker/daemon.json              # 这个就是加速器相关的文件
{"registry-mirrors": ["http://f1361db2.m.daocloud.io"]} 
[root@docker ~]# docker -v
Docker version 18.09.0, build 4d60db4