To delete Docker images that are older than a certain date, do the following:
Docker image layers are stored as separate artifacts within an image folder. Accordingly, to delete old Docker images, you’ll first want to search for your manifest.json file in your Docker images folder by doing the following:
Using Artifactory Query Language (AQL), get a manifest.json list containing those files that are older than a given date. For example, you can use the following manifest.json to return a list of files that are four (4)-weeks old and over:
Note: This will also return the repo and path in the search results.
To delete images, you can use the:
Delete Item REST API to delete the Docker image associated with a particular path returned in your AQL search results. However, if a layer is shared between two different images, but only one is a candidate for deletion, then that layer will not be deleted from your binary storage because it’s still being referenced by the other image.
Artifactory Clean Docker Images user plugin
Published: Feb. 3, 2020
Last updated: Feb. 24, 2021
Keywords: delete old Docker images, Docker tags