AI prompts
base on 很多镜像都在国外。比如 gcr 。国内下载很慢,需要加速。致力于提供连接全世界的稳定可靠安全的容器镜像服务。 # public-image-mirror
- 白名单 & 限流 的公开信息 [#2328](https://github.com/DaoCloud/public-image-mirror/issues/2328)
- 如有疑问请咨询 [#4183](https://github.com/DaoCloud/public-image-mirror/issues/4183)
## 背景 & 目标
很多镜像都在国外。比如 gcr 。国内下载很慢,需要加速。
* 一个简洁有效的方法能够加速这些包。简洁的名称映射
* 易于添加,添加新的包,不需要去修改代码。
* 稳定可靠,更新实时。每天检查同步情况。
* 此项目仅是源镜像仓库 (Registry) 的 Mirror
* 所有 hash(sha256) 均和源保持一致 (懒加载机制)。
* 由于缓存的存在, 可能存在 1 小时的延迟。
* 如超过 1 小时还未更新, 估计是国际带宽挂了。
* 对于 镜像层(blob) 会缓存在第三方对象存储上
* 当前暂未对内容做任何检测, 计划会添加检测。
## 快速开始
```
docker run -d -P m.daocloud.io/docker.io/library/nginx
```
## 使用方法
**增加前缀** (推荐方式)。比如:
``` log
docker.io/library/busybox
|
V
m.daocloud.io/docker.io/library/busybox
```
或者 支持的镜像仓库 的 *前缀替换* 就可以使用。比如:
``` log
docker.io/library/busybox
|
V
docker.m.daocloud.io/library/busybox
```
## 单次单镜像同步
**!!!!!!!!!!!!!!!!!!!!!!!!强烈推荐!!!!!!!!!!!!!!!!!!!!!!!!**
您可以根据 [镜像同步 Issue 模板](https://github.com/DaoCloud/public-image-mirror/issues/new?labels=sync+image&template=sync-image.yml) 创建一个 Issue, 将会有机器人帮您优先主动同步指定的镜像
> 原先已经在下的镜像还是会继续走原来的, 需要重启 docker 再重新拉取才能走已经同步好的缓存过, 所以推荐先单次同步再尝试拉取
> 对于 latest 这种经常内容会发生变更的 tag 变更后会需要重新同步
## 懒加载
> 仅推荐用于小于 20MiB 的镜像
> 这条通道主要用于保持 image 是最新的, 每次拉取都会检查是否和上游保持同步
如果您看到下没有进度这是由于带宽有限只要有几人在下较大的文件就会阻塞后续的下载, 可以尝试[单次单镜像同步](#单次单镜像同步)
就算没同步也能 **直接拉取**, 初次拉取会比已经同步过的慢.
## 定期同步列表 (不推荐)
已经太大了, 不再支持添加, 请使用[单次单镜像同步](#单次单镜像同步)
[mirror.txt](mirror.txt)
## 支持前缀替换的 Registry (不推荐)
推荐使用添加前缀的方式.
前缀替换的 Registry 的规则, 这是人工配置的, 有需求提 Issue.
| 源站 | 替换为 | 备注 |
| ----------------------- | ----------------------------- | ------------------------------------- |
| docker.elastic.co | elastic.m.daocloud.io | |
| docker.io | docker.m.daocloud.io | |
| gcr.io | gcr.m.daocloud.io | |
| ghcr.io | ghcr.m.daocloud.io | |
| k8s.gcr.io | k8s-gcr.m.daocloud.io | k8s.gcr.io 已被迁移到 registry.k8s.io |
| registry.k8s.io | k8s.m.daocloud.io | |
| mcr.microsoft.com | mcr.m.daocloud.io | |
| nvcr.io | nvcr.m.daocloud.io | |
| quay.io | quay.m.daocloud.io | |
## 最佳实践
* 通过 加速 安装 kubeadm
``` bash
kubeadm config images pull --image-repository k8s-gcr.m.daocloud.io
```
* 通过 加速 安装 kind
``` bash
kind create cluster --name kind --image m.daocloud.io/docker.io/kindest/node:v1.22.1
```
* 通过 加速 部署 应用(这里以 Ingress 为例)
``` bash
wget -O image-filter.sh https://github.com/DaoCloud/public-image-mirror/raw/main/hack/image-filter.sh && chmod +x image-filter.sh
wget -O deploy.yaml https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.0/deploy/static/provider/baremetal/deploy.yaml
cat ./deploy.yaml | ./image-filter.sh | kubectl apply -f -
```
* Docker 加速
添加到 `/etc/docker/daemon.json`
``` json
{
"registry-mirrors": [
"https://docker.m.daocloud.io"
]
}
```
## [友情链接]加速三剑客
* 镜像加速:https://github.com/DaoCloud/public-image-mirror
* 二进制文件加速:https://github.com/DaoCloud/public-binary-files-mirror
* Helm 加速:https://github.com/DaoCloud/public-helm-charts-mirror
## 贡献者
<a href="https://github.com/DaoCloud/public-image-mirror/graphs/contributors">
<img src="https://contrib.rocks/image?repo=DaoCloud/public-image-mirror" />
</a>
Made with [contrib.rocks](https://contrib.rocks).
", Assign "at most 3 tags" to the expected json: {"id":"10695","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"