Remove Docker images from Nexus Repository Manager OSS 3.0.1-01

Brice Argenson picture Brice Argenson · Aug 8, 2016 · Viewed 8.4k times · Source

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!

Answer

asolanki picture asolanki · Mar 29, 2019

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.