Skip to content

Deletes incorrect images #46

@dvazquez1027

Description

@dvazquez1027

I'm cleaning up a nexus repo after a massive coding effort that generated many images, manifests and tags. Since I made the mistake of using a single docker-hosted repo for snapshots and releases, I have to be careful what I delete. Images destined for a test environment are tagged with 'stage' in addition to the commit SHA. I can't use nexus-cli's 'keep' feature because the image tagged with stage may not be the latest image pushed to the repository. I use this comment to delete the unwanted images:

nexus-cli image tags -n image-name | grep -Ev "stage|There" | xargs -I{} nexus-cli image delete -n image-name -t {}

The grep removes the stage tag and the summary line from the list of image tags. The first run of this command deletes most of the tags with some exceptions. The output has '404 not found' interleaved with the '...successful deleted' messages'. A second run deletes tags missed on the first run. Continuing to run the command until I see no 404's yields a nasty surprise. image-name, all of its manifests and tags (including stage) are gone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions