从docker官方下载镜像速度那叫一个慢。解决这个问题可以用daocloud提供的镜像服务。
首先去https://www.daocloud.io注册个账号,登陆后,找到”加速器”,网页顶部有个火箭图标…
执行它给出的命令会自动配置。but,在centos7下yum装的docker-1.12.6经过这个脚本配置是无法启动的。
报错信息:
[root@localhost ~]# systemctl status docker.service -l ● docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Tue 2017-08-29 11:01:59 CST; 2min 48s ago Docs: http://docs.docker.com Process: 4145 ExecStart=/usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY (code=exited, status=1/FAILURE) Main PID: 4145 (code=exited, status=1/FAILURE) Aug 29 11:01:59 localhost systemd[1]: Starting Docker Application Container Engine... Aug 29 11:01:59 localhost dockerd-current[4145]: time="2017-08-29T11:01:59+08:00" level=fatal msg="unable to configure the Docker daemon with file /etc/docker/daemon.json: invalid character '}' looking for beginning of object key string\n" Aug 29 11:01:59 localhost systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE Aug 29 11:01:59 localhost systemd[1]: Failed to start Docker Application Container Engine. Aug 29 11:01:59 localhost systemd[1]: Unit docker.service entered failed state. Aug 29 11:01:59 localhost systemd[1]: docker.service failed.
在http://pagespeed.v2ex.com/t/326229找到答案。
需要手动去改 /etc/sysconfig/docker 而不是脚本中改的 /etc/docker/daemon.json
复制下daemon.json中给出的http开头的地址,然后清理掉脚本配置的daemon.json文件,只留一行{}。
[root@localhost ~]# cat /etc/docker/daemon.json {"registry-mirrors": ["http://bde0df14.m.daocloud.io"],}
然后去修改/etc/sysconfig/docker
[root@localhost ~]# cat /etc/sysconfig/docker # /etc/sysconfig/docker # Modify these options if you want to change the way the docker daemon runs OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false --registry-mirror=http://bde0df14.m.daocloud.io'
添加--registry-mirror=http://bde0df14.m.daocloud.io
重启docker服务
再docker pull 速度就很快了。
原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/3849.html