mirror of
https://github.com/yeasy/docker_practice.git
synced 2024-11-24 15:28:54 +00:00
64 lines
2.9 KiB
Go
64 lines
2.9 KiB
Go
## Mirror Accelerators
|
|
|
|
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,
|
|
|
|
* [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)
|
|
|
|
> Since some mirror services may be down sometimes, it is recommended to configure multiple mirrors simultaneously.
|
|
|
|
> 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.
|
|
|
|
|
|
### Ubuntu 16.04+、Debian 8+、CentOS 7
|
|
|
|
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.
|
|
|
|
```json
|
|
{
|
|
"registry-mirrors": [
|
|
"https://dockerhub.azk8s.cn",
|
|
"https://reg-mirror.qiniu.com"
|
|
]
|
|
}
|
|
```
|
|
> Note, make sure the file is in valid json format, otherwise Docker will be unable to start.
|
|
|
|
Then restart the service.
|
|
|
|
```bash
|
|
$ sudo systemctl daemon-reload
|
|
$ sudo systemctl restart docker
|
|
```
|
|
|
|
> 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`).
|
|
|
|
### Windows 10
|
|
|
|
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.
|
|
|
|
### macOS
|
|
|
|
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.
|
|
|
|
### Verify the Accelerator
|
|
|
|
After executing `$docker info`, if you can see the following result, you have successfully configured it.
|
|
|
|
```bash
|
|
Registry Mirrors:
|
|
https://dockerhub.azk8s.cn/
|
|
```
|
|
|
|
### gcr.io Mirror
|
|
|
|
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
|
|
|
|
```bash
|
|
# $ docker pull gcr.io/google_containers/hyperkube-amd64:v1.9.2
|
|
|
|
$ docker pull gcr.azk8s.cn/google_containers/hyperkube-amd64:v1.9.2
|
|
``` |