
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
Clean images in Harbor by policies.
GitHub: https://github.com/cd1989/harbor-cleaner
| Image | Project | Repo | Tag |
|---|---|---|---|
| library/busybox:1.30.0 | library | busybox | 1.30.0 |
| release/devops/tools:v1.0 | release | devops/tools | v1.0 |
Number policy will retain latest N tags for each repo and remove other old ones. Latest tags are determined by images' creation time.
yamlnumberPolicy: number: 5
This policy takes only one argument, the number of tags to retain.
Regex policy removes images that match the given repo and tag regex patterns. A tag will be removed only when following conditions are all satisfied:
Regex here are Golang supported regex. For example .* matches all.
yamlregexPolicy: repos: [".*"] tags: [".*-alpha.*", "dev"]
The above policy config will remove tags from all repos that are 'dev' or contain 'alpha'. For example,
This policy works depends on Harbor's access log. It collects images that are recently touched (pull, push, delete), and remove all other images that are not touched recently. It takes a time in second to configure the time period.
yamlnotTouchedPolicy: time: 604800
yaml# Host of the Harbor host: https://dev.cargo.io # Version of the Harbor, e.g. 1.7, 1.4.0 version: 1.7 # Admin account auth: user: admin password: Pwd123456 # Projects list to clean images for, it you want to clean images for all # projects, leave it empty. projects: [] # Policy to clean images policy: # Policy type, e.g. "number", "regex", "recentlyNotTouched" type: number # Number policy: to retain the latest N tags for each repo # This configure takes effect only when 'policy.type' is set to 'number' numberPolicy: number: 5 # Regex policy: only clean images that match the given repo patterns and tag patterns # This configure takes effect only when 'policy.type' is set to 'regex' regexPolicy: # Regex to match repos, a repo will be regarded as matched when it matches any regex in the list repos: [".*"] # Regex to match tags, a tag will be regarded as matched when it matches any regex in the list tags: [".*-alpha.*", "dev"] # Recently not touched policy: clean images that not touched within the given time period # This configure takes effect only when 'policy.type' is set to 'recentlyNotTouched' notTouchedPolicy: # Time in second that to check for images time: 604800 # Tags that should be retained anyway, '?', '*' supported. retainTags: [] # Trigger for the cleanup, if you only want to run cleanup once, remove the 'trigger' part or leave # the 'trigger.cron' empty trigger: # Cron expression to trigger the cleanup, for example "0 0 * * *", leave it empty will disable the # trigger and fallback to run cleanup once. Note: you may need to quote the cron expression with double quote cron:
In the policy part, exact one of numberPolicy, regexPolicy should be configured according to the policy type.
bash$ docker run -it --rm \ -v <your-config-file>:/workspace/config.yaml \ harbor-cleaner:v0.3.0 --dryrun=true
bash$ docker run -it --rm \ -v <your-config-file>:/workspace/config.yaml \ harbor-cleaner:v0.3.0
Configure the cron trigger and run harbor cleaner container in background.
yaml# Trigger for the cleanup, if you only want to run cleanup once, remove the 'trigger' part or leave # the 'trigger.cron' empty trigger: # Cron expression to trigger the cleanup, for example "0 0 * * *", leave it empty will disable the # trigger and fallback to run cleanup once. cron: 0 0 * * *
bash$ docker run -d --name=harbor-cleaner --rm \ -v <your-config-file>:/workspace/config.yaml \ k8sdevops/harbor-cleaner:v0.3.0
It may work for other versions, but this is not tested.
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务