首页   快速返回

docker设置镜像仓库     所属分类 docker
Registry Mirror 加速器
DaoCloud 加速器
https://www.daocloud.io/mirror

使用加速器直接从国内的地址下载 Docker Hub 的镜像


curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
该脚本可以将 --registry-mirror 加入到Docker 配置文件 /etc/docker/daemon.json 中



curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
docker version >= 1.12
{"registry-mirrors": ["http://f1361db2.m.daocloud.io"],}
Success.
You need to restart docker to take effect: sudo systemctl restart docker


ystemctl 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.

启动失败  

systemctl status docker.service

5月 09 18:07:10 VM_0_16_centos systemd[1]: Starting Docker Application Container Engine...
5月 09 18:07:11 VM_0_16_centos dockerd-current[20408]: unable to configure the Docker daemon with file /etc/docker/daemon.json: invalid character '}' look...y string
5月 09 18:07:11 VM_0_16_centos systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
5月 09 18:07:11 VM_0_16_centos systemd[1]: Failed to start Docker Application Container Engine.
5月 09 18:07:11 VM_0_16_centos systemd[1]: Unit docker.service entered failed state.
5月 09 18:07:11 VM_0_16_centos systemd[1]: docker.service failed.



cat /etc/docker/daemon.json
{"registry-mirrors": ["http://f1361db2.m.daocloud.io"],}

去掉多余的 ,

{"registry-mirrors": ["http://f1361db2.m.daocloud.io"]}


curl http://f1361db2.m.daocloud.io/
返回 OK 


 
restart 成功

设置检查 docker info 

Registry Mirrors:
 http://f1361db2.m.daocloud.io




运行 docker run  测试 

docker run ubuntu echo 'hello world'

Unable to find image 'ubuntu:latest' locally
Trying to pull repository docker.io/library/ubuntu ... 
latest: Pulling from docker.io/library/ubuntu
f476d66f5408: Pull complete 
8882c27f669e: Pull complete 
d9af21273955: Pull complete 
f5029279ec12: Pull complete 
Digest: sha256:d26d529daa4d8567167181d9d569f2a85da3c5ecaf539cace2c6223355d69981
Status: Downloaded newer image for docker.io/ubuntu:latest
hello world

上一篇     下一篇
rocketmq要点

Docker和K8S

docker安装和使用

docker run 与 start的区别

docker commit命令使用

使用Dockerfile定制镜像