Docker镜像加速
docker 中,只能够为 docker 官方镜像仓库 hub.docker.com 提供 mirror 加速,自建的 docker 镜像仓库是不能配置 mirror 加速的
# Docker中国 mirror
https://registry.docker-cn.com
# 腾讯云 docker hub mirror
https://mirror.ccs.tencentyun.com
# 华为云镜像
https://05f073ad3c0010ea0f4bc00b7105ec20.mirror.swr.myhuaweicloud.com
# DaoCloud 镜像
http://f1361db2.m.daocloud.io
# 阿里云 docker hub mirror
https://registry.cn-hangzhou.aliyuncs.com
修改镜像仓库 mirror 地址
修改 /etc/docker/daemon.json 文件(如果没有,则创建),添加 registry-mirrors 字段,重启 docker/kubelet
vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://registry.cn-hangzhou.aliyuncs.com"]
}
systemctl daemon-reload
systemctl restart docker
systemctl start kubelet # 假设您安装了 kubenetes
查看修改结果
docker info
...
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://registry.cn-hangzhou.aliyuncs.com # 注意这一行
Live Restore Enabled: false
Product License: Community Engine