Housekeep your local image registry

Zhimin Wen
3 min readFeb 23, 2022
Image by 👀 Mabel Amber, who will one day from Pixabay

You may have a local image registry setup (using where you manage your own images. But after a while, housekeeping is required.

Remove individual image

Instead of calling some of the registry API through curl, let’s use the tool called crane from the go-containerregistry repo.

Download the tool from releases, untar it,

sudo mv crane /usr/local/bin

Now login to the local registry

crane auth login localhost:5000 -u username -p password

List the catalog,

crane catalog localhost:5000 --insecure

As I am using self-sign cert, add the — insecure flag. If the cert is updated in the system’s trusted cert and you are running the command locally on the server, then this flag is not required.

From the above output, select a repo, list all its tags,

$ crane ls localhost:5000/cp/ibm-mqadvanced-server --insecure

Now let's say we want to remove the tag “” from the registry. First get the digest value of the image,

$ crane --insecure digest…