Skip to main content

Container image cleanup

As part of regular system maintenance it is recommended that the OpsChain runner images are regularly pruned to limit disk usage. After following this guide you should know how to:

  • remove older MintPress images
  • remove images for a specific change

Removing images by tag

MintPress uses runner images to run changes. These images are built whenever a change is run. MintPress provides some utilities to help with cleanup.

List runner image tags in the registry

kubectl exec -n ${KUBERNETES_NAMESPACE} deploy/opschain-api -- /usr/bin/container_start.sh "rake release:list_runner_image_tags"

Remove a runner image tag from the registry

kubectl exec -n ${KUBERNETES_NAMESPACE} deploy/opschain-api -- /usr/bin/container_start.sh "rake release:remove_runner_image_tag[<tag_to_remove>]"

The internal registry garbage collection will then remove these images from disk.

Removing images

MintPress adds container labels to runner images to allow for simplified cleanup. If no cleanup is performed then these images will continue to consume disk space.

With crictl

Using crictl, which is installed by default with k3s, you can view the images for a certain MintPress version using the following command:

crictl images | grep <version>

If you wish to remove all images from a MintPress version, you can use the following command:

crictl images | grep <version> | awk '{print $3}' | xargs crictl rmi
warning

This command will remove all images with the given version, ensure they are not required for audit purposes and are not being used by any changes or workers.

Internal registry garbage collection

Step runner images are built whenever a change runs a step. MintPress runs a garbage collection process to remove these images after 24 hours. If you need more control of this process please contact LimePoint support.