21

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.

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. I know there's a Nexus task to remove unused artifacts but it seems to work only for Maven and 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?

Thanks!

Brice Argenson
  • 802
  • 2
  • 8
  • 13
  • Possible duplicate of [Deleting images from a private docker registry](http://stackoverflow.com/questions/25436742/deleting-images-from-a-private-docker-registry) – user5994461 Apr 29 '17 at 21:59

4 Answers4

10

Yes to clean up old container images periodically you need to set up two tasks

  1. Cleanup container images
  2. Compact blob store.

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
    1. Provide a name, Set format as docker Specify a criteria . 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.

Together both the task created above will do the clean up docker blobs as per criteria defined in the policy.

asolanki
  • 1,333
  • 11
  • 18
0

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.

Deleting component function is enabled only for admin user, by default.

here is screenshot for reference

Vishwa
  • 67
  • 1
  • 12
  • 2
    I was asking about a way to remove more than one component at a time. We have a new component generated after each build. We need either a way to configure images retention or at least a way to remove manually more than one at a time. – Brice Argenson Aug 11 '16 at 16:31
  • @BriceArgenson for that creating a task should be enough. You can specify to remove unused assets or components. Have you tried that? – Vishwa Aug 24 '16 at 05:52
  • 1
    @user3524747 that task only allows you to select proxied repositories (so not hosted docker repositories) – Tim Webster Nov 16 '16 at 17:56
0

For this feature to appear in Nexus, a general question within Docker Registry API should be resolved, see Deleting images from a private docker registry

Community
  • 1
  • 1
Paul Verest
  • 60,022
  • 51
  • 208
  • 332
0

You can use registry-cli tool to clean up old images. For example, this command:

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

will delete all but the last 10 images.

isalgueiro
  • 1,973
  • 16
  • 20