Removing an image from the console

You can remove an image from the IBM® Cloud Private management console.

Required user type or access level: Cluster administrator or team administrator

  1. From the navigation menu, click Container images.
  2. For the image that you want to remove, select Action > Remove.
  3. Click Remove Image. The image is removed from the management console.
  4. Remove the image files from the private registry storage.

Removing image files from the private registry storage

Deleting an image from the IBM Cloud Private management console is a soft deletion. For a soft deletion, the image is removed from the IBM Cloud Private cluster, however the files for the image remains in the private registry storage. To delete the files from the image registry storage, you must use the registry's garbage collection(GC) tool.

To remove images from the private registry storage, complete the following steps:

  1. Disable the image manager. If images are pushed to the registry while the GC process is running, there is a risk that the new image's layers are deleted. This can result in a corrupted image. To disable the image manager, run the following command:

     kubectl patch svc image-manager -n kube-system  -p '{"spec": {"selector": {"app": "image-manager-dummy"}}}'
    

    The output resembles the following code:

     service "image-manager" patched
    
  2. View the files that are to be cleaned up by the garbage collection process.

     kubectl exec -it image-manager-0 -c icp-registry  -n kube-system -- registry garbage-collect --dry-run /etc/docker/registry/config.yml
    

    NOTE: The --dry-run option prints the clean up plan without removing any data.

  3. Run the garbage collection tool.

     kubectl exec -it image-manager-0 -c icp-registry  -n kube-system -- registry garbage-collect  /etc/docker/registry/config.yml
    
  4. Restart the image manager pods. The image manager pod can be identified with image-manager-*. Deleted pods will be automatically recreated. Run the following command for each image manager pod (that is, replace po/image-manager-0 with po/image-manager-1, po/image-manager-2 for clusters with multiple master nodes):

     kubectl delete po/image-manager-0 -n kube-system
    
  5. Enable the image manager.

     kubectl patch svc image-manager -n kube-system  -p '{"spec": {"selector": {"app": "image-manager"}}}'
    

    The output resembles the following code:

     service "image-manager" patched