How to delete an image in Nexus

Hi Team,

I am evaluating Nexus and for image deletion i can see there are 2 tasks (Delete unused manifest and compact blobstore) which actually can be used for image deletion.
I am trying to have a client tool where i want to fetch the component ID for each image an then perform deletion but what i noticed it:

lets say i have 2 repositories: Repo1 has 5 images and Repo2 has 10 images.
For Repo1 i can see 5 component ids getting created(Its like 1:1 mapping) but for Repo 2 there are only 5 component Ids been created(even though there are 10 images).

For repo 1 if i capture the ID i am able to delete any of the images from the tool but for Repo2 the images which does not have component id is not getting deleted.

Any reason how this images are mapped with component ID.
Any idea/suggestion related to image deletion would be appreciated.

Regards
Nibedita

Hi Nibedita,
Welcome to the community.

The two tasks you mentioned are not tasks to delete specific images by IDs, but yes you should use them to reclaim free disk space. Please see our documentation: Tasks

Each uploaded or proxied Docker image tag should result in individual component with unique ID stored in Nexus Repository database. How do you get your numbers of images and their component IDs?

Hi Dawid,

Thank You for your email.
We are using the “/v1/components” List components API from nexus to capture the component ID.
Version used: Sonatype Nexus Repository Manager OSS 3.15.2-01
Could you please let us the correct API which can be used for deleting a docker image because the component list API is not giving consistent result also the image count is not matching with the number of component ID’s(For each image it is not creating an unique ID).

Regards
Nibedita

Hi Dawid,

Any updates on this topic. Any pointer will be much appreciated.
Regards
Nibedita

I found the way how to get all the Id’s. Its basically the continuation token we need to use.
Thank you

2 Likes