Centos7.0 配置docker 镜像加速

因为网络原因,国内的开发者从docker hub下载镜像,经常会出现下载中断的问题。查询资料了解到可以使用国内的容器Hub加速服务解决这个问题,其本质就是更改pull优先级较高的服务器为国内的站点,下面分享操作步骤。

加速地址

DaoCloud

系统环境

[root@iZ51hzu4zdjgpnZ home]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 
[root@iZ51hzu4zdjgpnZ home]# docker version
Client:
 Version:         1.13.1
 API version:     1.26
 Package version: docker-1.13.1-74.git6e3bb8e.el7.centos.x86_64
 Go version:      go1.9.4
 Git commit:      6e3bb8e/1.13.1
 Built:           Tue Aug 21 15:23:37 2018
 OS/Arch:         linux/amd64

Server:
 Version:         1.13.1
 API version:     1.26 (minimum version 1.12)
 Package version: docker-1.13.1-74.git6e3bb8e.el7.centos.x86_64
 Go version:      go1.9.4
 Git commit:      6e3bb8e/1.13.1
 Built:           Tue Aug 21 15:23:37 2018
 OS/Arch:         linux/amd64
 Experimental:    false

DaoCloud加速

访问DaoCloud 配置指引,根据指引DaoCloud提供一键配置脚本。

但直接复制脚本运行后,重启失败

[root@iZ51hzu4zdjgpnZ home]# service docker restart
Redirecting to /bin/systemctl restart docker.service
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

检查后发现,/etc/docker/daemon.json 文件的json格式存在问题,直接手动修改,修改为

{
"registry-mirrors": [
       "http://8882ac6a.m.daocloud.io"
    ],
    "insecure-registries": []
}

手动修改后重启服务器

[root@iZ51hzu4zdjgpnZ home]# service docker restart
Redirecting to /bin/systemctl restart docker.service

重启成功后,就可以愉快的下载镜像啦~

你可能感兴趣的:(Centos7.0 配置docker 镜像加速)