Skip to content

Speeding up Docker Downloads in China

Introduction

If you are located in mainland China, you might have a hard time pulling docker images, however, you can speed things up by using the Docker Mirror hosted by USTC.

Configure Docker Daemon

You can configure the Docker daemon using a JSON file. Usually it's located at /etc/docker/daemon.json; if it doesn't exist create a new one. Then, add "https://docker.mirrors.ustc.edu.cn/" to the registry-mirrors array to pull from the USTC registry mirror by default.

After editing, your /etc/docker/daemon.json should look like this:

{
    "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/"]
}

If this is not the first time you are editing the daemon.json, there may be other configuration already there. You can simply add the line above after any existing configuration.

Then restart dockerd:

sudo systemctl restart docker

Verify Default Registry Mirror

You can verify your changes by:

docker info

If you see the following lines, you have configured your Docker daemon successfully.

Registry Mirrors:
    https://docker.mirrors.ustc.edu.cn/