curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://a9cd99d0.m.daocloud.io
Copy
该脚本可以将 --registry-mirror 加入到你的 Docker 配置文件 /etc/default/docker 中。适用于 Ubuntu14.04、Debian、CentOS6 、CentOS7、Fedora、Arch Linux、openSUSE Leap 42.1,其他版本可能有细微不同。更多详情请访问文档。
如果允许后,报出:
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
[root@localhost /]# service docker start
Redirecting to /bin/systemctl start 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.
那么修改方案为:
[root@localhost /]# cd /etc/docker/
[root@localhost docker]# ls
certs.d daemon.json daemon.json.bak key.json
[root@localhost docker]# vim daemon.json
{"registry-mirrors": ["http://a9cd99d0.m.daocloud.io"],"storage-driver":"devicemapper"}