简体   繁体   English

从 Nexus Repository Manager OSS 3.0.1-01 中删除 Docker 镜像

[英]Remove Docker images from Nexus Repository Manager OSS 3.0.1-01

I've been using Nexus to publish my Docker images for a couple of months and I really like the features it adds to a classic Docker Registry.几个月来,我一直在使用 Nexus 发布我的 Docker 映像,我非常喜欢它添加到经典 Docker Registry 的功能。

Recently, the number of images we're storing caused disk space issues.最近,我们存储的图像数量导致磁盘空间问题。 I looked around the graphical interface and there's apparently nothing to remove several Docker images at the same time.我环顾图形界面,显然没有什么可以同时删除多个 Docker 映像。 I know there's a Nexus task to remove unused artifacts but it seems to work only for Maven and Nugget.我知道有一个 Nexus 任务可以删除未使用的工件,但它似乎只适用于 Maven 和 Nugget。

Is there a way with Nexus Repository Manager OSS 3.0.1-01 to remove unused images or at least several images at the same time? Nexus Repository Manager OSS 3.0.1-01 有没有办法同时删除未使用的图像或至少多个图像?

Thanks!谢谢!

Yes to clean up old container images periodically you need to set up two tasks是的,要定期清理旧容器映像,您需要设置两个任务

  1. Cleanup container images清理容器镜像
  2. Compact blob store.紧凑的 blob 商店。

The first is just soft delete (marking for deletion), the second task does the job of actual clean up so make sure you do both.第一个只是软删除(标记为删除),第二个任务执行实际清理工作,因此请确保两者都执行。

Below are the steps下面是步骤

  1. Log in to nexus repo ->settings-> Repository ->Clean up Policies ->Create Clean up Policy登录nexus repo ->settings->Repository ->Clean up Policies ->Create Clean up Policy
    1. Provide a name, Set format as docker Specify a criteria .提供一个名称,将格式设置为docker指定一个标准。 Click Create点击创建
    2. Select Repository -> Repositories ->选择存储库 -> 存储库 ->
    3. In The Clean up Policy select your recently created clean up policy在清理策略中选择您最近创建的清理策略
    4. Save保存
    5. Select Tasks from Administrations tab从管理选项卡中选择任务
    6. You will see a task你会看到一个任务
    7. Select Create Task -> Compact Blob Store ->Select default blob store and specify your clean up schedule.选择创建任务 -> 压缩 Blob 存储 -> 选择默认 Blob 存储并指定清理计划。

Together both the task created above will do the clean up docker blobs as per criteria defined in the policy.上面创建的两个任务将一起按照策略中定义的标准清理 docker blob。

There doesn't seems to have any option to delete components from Group Repository but you have option to delete component from Proxy or Hosted repository.似乎没有任何选项可以从 Group Repository 中删除组件,但您可以选择从 Proxy 或 Hosted 存储库中删除组件。

Deleting component function is enabled only for admin user, by default.默认情况下,删除组件功能仅对 admin 用户启用。

here is screenshot for reference这是截图供参考

要在 Nexus 中显示此功能,应解决 Docker Registry API 中的一般问题,请参阅从私有Docker 注册表中删除图像

You can use registry-cli tool to clean up old images.您可以使用registry-cli工具来清理旧图像。 For example, this command:例如,这个命令:

registry.py -l "login:password" -r https://your-registry.example.com --delete

will delete all but the last 10 images.将删除除最后 10 张图像之外的所有图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM