常用开源镜像站

商业巨头们

再来点教育网的

这些镜像站通常在提供镜像的同时还会提供用法,比如:

阿里的镜像已经被列入黑名单,竟然限速至200KB/s,本来是为了加速,使用镜像后反倒变龟速。

更推荐几个头部大学的镜像站,比如清华、浙大、中科大。速度快,同步频率也比商业巨头高。

github

国内有一个ghproxy提供了github的镜像源,在git clone时,只要使用git clone https://ghproxy.com/https://github.com/stilleshan/ServerStatus,即在正常的github链接前面加上https://ghproxy.com/即可实现镜像。

如果想润物细无声,可以修改git设置:

1
git config --global url."https://ghproxy.com/https://github.com".insteadOf "https://github.com"

这样对使用来说就比较无感了,但会影响git push,不建议使用。

dockerhub

国内源

https://hub-mirror.c.163.com

https://mirror.baidubce.com

需要登录后,去管理控制台中的镜像加速器查看自己的id,以获取加速器地址:https://${your_id}.mirror.aliyuncs.com

使用方法

修改daemon.json,添加以下内容

1
2
3
{
"registry-mirrors": ["https://<my-docker-mirror-host>"]
}

然后重启docker daemon以生效。可参见官方文档

可用docker info来查看Registry Mirrors有没有应用成功。

linux

具体到linux上

  1. docker是使用apt安装的

此时daemon.json的位置在/etc/docker/daemon.json,修改完后可使用

1
2
sudo systemctl daemon-reload
sudo systemctl restart docker

来重启docker.service。

  1. docker是使用snap安装的

此时daemon.json的位置在/var/snap/docker/current/config/daemon.json,修改完后使用

1
snap restart docker

来重启docker服务。

windows

windows上,daemon.json的位置在%USERPROFILE%\.docker\daemon.json,一般直接用Docker Desktop的GUI界面来重启docker daemon。