2020-10-26 08:35:34 +00:00
# # Mirror Accelerators
2016-11-12 19:48:40 +00:00
2020-10-26 08:35:34 +00:00
You may have difficulty pulling images from Docker Hub if you are in China . To resolve this issue , you may configure mirror accelerators . There are many cloud service providers that provide accelerators in China , for example ,
2016-11-12 19:48:40 +00:00
2020-10-26 08:35:34 +00:00
* [ Azure China Mirrors ` https://dockerhub.azk8s.cn ` ] ( https : //github.com/Azure/container-service-for-azure-china/blob/master/aks/README.md#22-container-registry-proxy)
* [ Alibaba Cloud Accelerator ( Login Required ) ] ( https : //cr.console.aliyun.com/cn-hangzhou/mirrors)
* [ Qiniu Cloud Accelerator ` https://reg-mirror.qiniu.com ` ] ( https : //kirk-enterprise.github.io/hub-docs/#/user-guide/mirror)
2016-11-12 19:48:40 +00:00
2020-10-26 08:35:34 +00:00
> Since some mirror services may be down sometimes , it is recommended to configure multiple mirrors simultaneously .
2018-06-28 03:15:25 +00:00
2020-10-26 08:35:34 +00:00
> Most of the cloud service giants in China provide Docker image acceleration services , you can choose acceleration services based on which platform you are running Docker on . For more detailed information , you may refer to their official documents .
We take Azure China Mirrors ` https://dockerhub.azk8s.cn ` as an example to introduce more .
2018-07-10 00:07:31 +00:00
2016-11-12 19:48:40 +00:00
2017-10-19 15:24:41 +00:00
# # # Ubuntu 16.04 + 、 Debian 8 + 、 CentOS 7
2016-11-12 19:48:40 +00:00
2020-10-26 08:35:34 +00:00
For Operating Systems using [ systemd ] ( https : //www.freedesktop.org/wiki/Software/systemd/), please write the following contents inside `/etc/docker/daemon.json`. And if the file does not exist, please create the file.
2016-11-12 19:48:40 +00:00
2017-10-19 15:24:41 +00:00
` ` ` json
{
"registry-mirrors" : [
2019-05-12 01:44:17 +00:00
"https://dockerhub.azk8s.cn" ,
"https://reg-mirror.qiniu.com"
2017-10-19 15:24:41 +00:00
]
}
2016-11-12 19:48:40 +00:00
` ` `
2020-10-26 08:35:34 +00:00
> Note , make sure the file is in valid json format , otherwise Docker will be unable to start .
2016-11-12 19:48:40 +00:00
2020-10-26 08:35:34 +00:00
Then restart the service .
2016-11-12 19:48:40 +00:00
` ` ` bash
$ sudo systemctl daemon - reload
$ sudo systemctl restart docker
` ` `
2020-10-26 08:35:34 +00:00
> Note : if you refered to the old tutorial previously , and modified the content of ` docker.service ` , please remove the added contents ( ` --registry-mirror=https://dockerhub.azk8s.cn ` ) .
2017-10-19 15:24:41 +00:00
2016-11-17 13:36:22 +00:00
# # # Windows 10
2020-10-26 08:35:34 +00:00
For windows 10 , choose ` Settings ` in the list after click on the Docker icon at the right - bottom of the desktop . Then choose ` Daemon ` , and inside the ` Registry mirrors ` , fill in ` https://dockerhub.azk8s.cn ` . And finally click ` Apply ` to save and apply the changes .
2016-11-17 13:36:22 +00:00
2017-04-27 10:53:06 +00:00
# # # macOS
2020-10-26 08:35:34 +00:00
For macOS users , click Docker Desktop icon at the task bar - > Perferences ... - > Daemon - > Registry mirrors . Then fill in the accelerator address ` https://dockerhub.azk8s.cn ` in the list . After the modification , click on ` Apply & Restart ` button , Docker will restart and apply the new mirror address .
2017-04-27 10:53:06 +00:00
2020-10-26 08:35:34 +00:00
# # # Verify the Accelerator
2016-11-12 19:48:40 +00:00
2020-10-26 08:35:34 +00:00
After executing ` $docker info ` , if you can see the following result , you have successfully configured it .
2016-11-12 19:48:40 +00:00
` ` ` bash
2017-08-21 07:02:49 +00:00
Registry Mirrors :
2019-05-12 01:44:17 +00:00
https : //dockerhub.azk8s.cn/
` ` `
2020-10-26 08:35:34 +00:00
# # # gcr . io Mirror
2019-05-12 01:44:17 +00:00
2020-10-26 08:35:34 +00:00
In China , we cannot fetch ` gcr.io/* ` mirrors direclty , but we can replace ` gcr.io/<repo-name>/<image-name>:<version> ` with ` gcr.azk8s.cn/<repo-name>/<image-name>:<version> ` , for example
2019-05-12 01:44:17 +00:00
` ` ` bash
2019-08-31 10:35:14 +00:00
# $ docker pull gcr . io / google_containers / hyperkube - amd64 : v1 .9 .2
2019-05-12 01:44:17 +00:00
2019-08-31 10:35:14 +00:00
$ docker pull gcr . azk8s . cn / google_containers / hyperkube - amd64 : v1 .9 .2
2020-10-26 08:35:34 +00:00
` ` `