Run image prune operations
Securely remove unused container images from your registry to reclaim the cluster disk space and prevent registry storage exhaustion.
-
You must be logged into the CLI with an access token.
-
You must have the
system:image-prunercluster role or greater (for example,cluster-admin). -
The image registry must be exposed.
-
You have reviewed the "Considerations when manually pruning images" section of this document.
-
Optional: To preview which images would be pruned, enter the following command. This command prints a list of the images, image streams, and pods that would be removed. Note that nothing is deleted until you add the
--confirmflag.$ oc adm prune images <image_prune_option_one> <image_prune_option_two>For more information about available pruning options, see "Manual image pruning command options".
-
Review the output to confirm the list of images, image streams, and pods to be removed.
-
Run the
oc adm prune imagescommand with the appropriate options for your cluster. Add the--confirmflag to confirm deletion. For example:$ oc adm prune images <image_prune_option_one> <image_prune_option_two> --confirm