一、配置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
若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)注册用户并且登录;
看到如下界面后往下翻
[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
来源:oschina
链接:https://my.oschina.net/u/4356296/blog/4460397