docker加速配置阿里云镜像
Docker加速器
使用Docker官方获取镜像,由于网络原因,拉取镜像的过程非常慢,通过配置docker加速器提升了国内网络访问Docker Hub的速度;
docker环境已安装
从DaoCloud获取,同样可以选择阿里云等获取;
[root@GaoServer docker]# curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://cd841f18.m.daocloud.io
docker version >= 1.12
{"registry-mirrors": ["http://cd841f18.m.daocloud.io"],}
Success.
You need to restart docker to take effect: sudo systemctl restart docker
[root@GaoServer docker]# systemctl daemon-reload
[root@GaoServer 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@GaoServer docker]# cat daemon.json
{"registry-mirrors": ["http://cd841f18.m.daocloud.io"],}
[root@GaoServer ~]# docker --version
Docker version 1.13.1, build 774336d/1.13.1
创建或修改 /etc/docker/daemon.json 文件,修改为如下形式 (请将 加速地址 替换为在加速器页面获取的专属地址)
[root@GaoServer docker]# vim daemon.json
{
"registry-mirrors": [
"http://cd841f18.m.daocloud.io"
],
"insecure-registries": []
[root@GaoServer docker]# systemctl daemon-reload
[root@GaoServer docker]# systemctl restart docker
[root@GaoServer docker]# docker pull docker.io/centos
Using default tag: latest
Trying to pull repository docker.io/library/centos ...
latest: Pulling from docker.io/library/centos
469cfcc7a4b3: Pull complete
Digest: sha256:4b63b3e9fe127c07a15458af7fcc187980a9fff8069063057bbc9c282f26f539
Status: Downloaded newer image for docker.io/centos:latest
[root@GaoServer docker]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/centos latest e934aafc2206 2 days ago 199 MB