Image pruning considerations

Review soft-delete conditions and registry caching behaviors before pruning images to prevent metadata corruption and protect active container deployment layers.

  • Pruning with the --namespace flag does not remove images. It only removes image streams, because images are cluster-scoped resources. Limiting pruning to a particular namespace makes it impossible to calculate current usage.

  • By default, the integrated registry caches metadata of blobs to reduce the number of requests to storage, and to increase request-processing speed. Pruning does not update the integrated registry cache. Images that still contain pruned layers after pruning will be broken because the pruned layers that have metadata in the cache will not be pushed. Therefore, you must redeploy the registry to clear the cache after pruning:

    $ oc rollout restart deployment/image-registry -n openshift-image-registry
  • If the integrated registry uses a Redis cache, you must clean the database manually.

  • If redeploying the registry after pruning is not an option, then you must permanently disable the cache.

  • oc adm prune images operations require a route for your registry. Registry routes are not created by default.