阿里云的镜像服务做得不错,包括常用的Debian(Ubuntu)和RedHat(CentOS)的镜像,各类开源软件的repo,以及docker的Container镜像,全部copy了一份在国内服务器上。下载速度就不再受限于你懂的大防火墙。系统及各类开源软件的备份直接看http://mirrors.aliyun.com/,下面单独说下Docker Hub在阿里的镜像加速器设置,以CentOS7为例。
登录阿里云开发者平台http://dev.aliyun.com/,进入加速器页面:
首先你得安装Docker Engine,根据Docker官网安装即可。阿里这里给出的配置步骤就是更改下Docker Daemon的参数,可以直接修改Docker服务配置文件/usr/lib/systemd/system/docker.service。要是使用版本1.12的话,Docker Daemon执行文件名有点不一样。
# docker version Client: Version: 1.12.5 API version: 1.24 Go version: go1.6.4 Git commit: 7392c3b Built: Fri Dec 16 02:23:59 2016 OS/Arch: linux/amd64 Server: Version: 1.12.5 API version: 1.24 Go version: go1.6.4 Git commit: 7392c3b Built: Fri Dec 16 02:23:59 2016 OS/Arch: linux/amd64
根据dockerd的–registry-mirror参数来修改。
# dockerd --help | grep registry --disable-legacy-registry Disable contacting legacy registries --insecure-registry=[] Enable insecure registry communication --registry-mirror=[] Preferred Docker registry mirror
# vim /usr/lib/systemd/system/docker.service [Unit] Description=Docker Application Container Engine Documentation=https://docs.docker.com After=network.target [Service] Type=notify # the default is not to use systemd for cgroups because the delegate issues still # exists and systemd currently does not support the cgroup feature set required # for containers run by docker ExecStart=/usr/bin/dockerd --registry-mirror=https://jnxt8d8b.mirror.aliyuncs.com #更改这里
修改之后再 重启docker服务:
# systemctl daemon-reload # systemctl restart docker