Deleting image tags from a Container Registry Enterprise Edition instance does not immediately release storage in the Object Storage Service (OSS) bucket. Unreferenced image data persists until you run a garbage collection task, which removes that data and reclaims the storage capacity.
Garbage collection applies to image repositories only. Expired chart tags in chart repositories are not removed from the OSS bucket.
Prerequisites
Before you begin, make sure you have:
A Container Registry Enterprise Edition instance
Verified that the image tags you plan to delete can be regenerated and pushed if needed (deleted tags cannot be recovered)
Stopped all operations on the OSS bucket that stores the Enterprise Edition data — do not perform any operations on that bucket during or after a garbage collection task
Step 1: Enable garbage collection
The first time you run garbage collection, you must submit a ticket to add your Alibaba Cloud account to the whitelist. This is a one-time step; subsequent tasks do not require it.
Log on to the Container Registry console.
In the top navigation bar, select a region.
In the left-side navigation pane, click Instances.
On the Instances page, click the Enterprise Edition instance you want to manage.
In the left-side navigation pane of the instance, choose Instances > Garbage Collection.
On the Garbage Collection page, click Execute.
In the Confirmation dialog box, click Submit Ticket to enable garbage collection.
Step 2: Create a garbage collection task
After garbage collection is enabled, run a task to delete expired image tags from all image repositories in the instance. Image pulls continue to work during the task.
Log on to the Container Registry console.
In the top navigation bar, select a region.
In the left-side navigation pane, click Instances.
On the Instances page, click the Enterprise Edition instance you want to manage.
In the left-side navigation pane of the instance, choose Instances > Garbage Collection.
On the Garbage Collection page, click Execute.
In the Confirmation message, read the precautions, select Confirm to clean up, and then click Confirm.
The system begins deleting expired image tags from all image repositories in the instance.
Verify the task and check storage results
After submitting the task, go to Instances > Garbage Collection in the left-side navigation pane to view the task status or cancel the task.
After the garbage collection task completes, OSS bucket storage capacity does not decrease immediately. The decrease takes effect after a number of days determined by the lifecycle rules configured for the bucket. Check the lifecycle rules on your OSS bucket to understand when the storage change will appear.
Limitations
Garbage collection is supported on Container Registry Enterprise Edition instances only.
Expired chart tags in chart repositories are not deleted from the OSS bucket.
Deleted image tags cannot be recovered.
What to do next
To remove image tags without running garbage collection, configure a tag retention policy. For more information, see Delete image tags.