Docker configuration accelerator

Keywords: Docker CentOS JSON network

Docker accelerator

Using docker to obtain images officially, because of network reasons, the process of pulling images is very slow. By configuring docker accelerator, the speed of accessing Docker Hub in domestic network is improved;

  • docker environment installed
[root@GaoServer ~]# docker run hello-world

Hello from Docker!
......
  • Obtained from DaoCloud, you can also select alicloud and other sources;
[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
  • DaoCloud definition:
    Docker version 1.12 or higher
    Create or modify the / etc/docker/daemon.json file as follows (replace the acceleration address with the exclusive address obtained on the accelerator page)
[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

Posted by jd57 on Tue, 31 Mar 2020 21:45:24 -0700