首先注册daocloud网站的账号(免费的!!!),并登陆自己的账号,并在这里获取自己的daocloud加速器配置脚本。
获取到自己的daocloud加速器配置脚本之后只需要在已安装Docker服务的服务器执行该脚本即可获得加速服务。
在使用daocloud官网提供的脚本配置加速器之后,重启docker服务可能会出现如下报错,导致docker服务不能启动:
[root@docker ~]# systemctl restart docker Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details. [root@docker ~]#
详细信息如下:
[root@docker ~]# systemctl status docker.service ● docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Wed 2017-08-30 19:11:39 CST; 2min 14s ago Docs: http://docs.docker.com Process: 5097 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: 5097 (code=exited, status=1/FAILURE) Aug 30 19:11:39 docker systemd[1]: Starting Docker Application Container Engine... Aug 30 19:11:39 docker dockerd-current[5097]: time="2017-08-30T19:11:39+08:00" level=fatal msg="unable to configure the Docker daemon with file /etc/...string " Aug 30 19:11:39 docker systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE Aug 30 19:11:39 docker systemd[1]: Failed to start Docker Application Container Engine. Aug 30 19:11:39 docker systemd[1]: Unit docker.service entered failed state. Aug 30 19:11:39 docker systemd[1]: docker.service failed. Hint: Some lines were ellipsized, use -l to show in full. [root@docker ~]#
解决办法:
可能是由于daocloud官方提供的脚本问题,导致/etc/docker/daemon.json中的json语法错误,只需要将文件中"{"registry-mirrors": ["http://271d509e.m.daocloud.io"],}"最后的","删除之后保存退出即可正常启动docker服务。
为了方便使用,本文中设置了超链接,读者只需要点击对应的超链接即可。