ibm-cloudcontainer-registryibm-cloud-code-engine

IBM Cloud: How to control number of container images caused by Code Engine builds?


I frequently build and deploy my app from source code using the IBM Cloud Code Engine feature. I noticed the container images filling up my container registry.

How can I reduce the number of images in the container registry or limit how many are kept at hand?


Solution

  • You can set a retention policy in the IBM Cloud Container Registry. This can be done by namespace. If you use a namespace for a Code Engine project, you can configure the number of container images that are kept.

    When logged in to IBM Cloud and the container registry, run this CLI command to limit the number of container images to 5 for the namespace my-ce-apps:

    ibmcloud cr retention-policy-set --images 5 my-ce-apps