Director tripleo image registry cleanup
Environment
- Red Hat Openstack Platform 16
Issue
- Undercloud directory
/var/lib/image-serve
is full of old images and the filesystem is almost full - How to remove old images from undercloud image registry?
Resolution
Check what image of every kind is currently running on your environment, and then remove the older ones.
For example, you have those nova-compute images in the registry:
| docker://undercloud.ctlplane.mgmt.cloud.internal:8787/rhosp-rhel8/openstack-nova-compute:16.1-43 |
| docker://undercloud.ctlplane.mgmt.cloud.internal:8787/rhosp-rhel8/openstack-nova-compute:16.1-48 |
| docker://undercloud.ctlplane.mgmt.cloud.internal:8787/rhosp-rhel8/openstack-nova-compute:16.1-52.1602000860 |
| docker://undercloud.ctlplane.mgmt.cloud.internal:8787/rhosp-rhel8/openstack-nova-compute:16.1.3-7 |
| docker://undercloud.ctlplane.mgmt.cloud.internal:8787/rhosp-rhel8/openstack-nova-compute:16.1.5-1.1618380193 |
| docker://undercloud.ctlplane.mgmt.cloud.internal:8787/rhosp-rhel8/openstack-nova-compute:16.1.5-4 |
| docker://undercloud.ctlplane.mgmt.cloud.internal:8787/rhosp-rhel8/openstack-nova-compute:16.1.5-4.1619641131 |
| docker://undercloud.ctlplane.mgmt.cloud.internal:8787/rhosp-rhel8/openstack-nova-compute:16.1
-
check the version that is currently running on your compute hosts:
podman ps --format="table {{.Names}} {{.Image}} {{.Status}}"|grep nova-compute\:
-
and you safely delete the other ones from the director:
openstack tripleo container image delete $image_name
-
That should free space on disk.
Also, you can remove these data at once by the following procedures.
-
Get the list of tags you want to keep or delete.
$ openstack tripleo container image list -f value | awk -F ":" '{print $NF}' | sort | uniq ... 16.1.6-7.1627296585 ...
-
Create /home/stack/cleanup_registry_data.sh, edit deletetags.
#!/bin/bash source /home/stack/stackrc deletetags="16.1.6-7.1627296585" for tag in $deletetags; do for image_name in $( openstack tripleo container image list -f value | grep "$tag\$" ); do sudo openstack tripleo container image delete -y $image_name done done
-
Run /home/stack/cleanup_registry_data.sh
Links
- tripleo container image delete command description
Root Cause
Any openstack update, add new images on the registry
Diagnostic Steps
-
From undercloud, check the number of the images of every kind
openstack tripleo container image list
-
Check the size of the directory that hosts the images regarding to the total space of the partition
df -hTP /var/lib/image-serve
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments