Accumulated image tags from repeated builds consume OSS storage and incur additional costs. You can configure tag retention policies to bulk-delete image tags from Container Registry Enterprise Edition instances.
Configure a tag retention policy
Image tags that fall outside the retention policy are deleted.
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 that you want to manage.
-
In the left-side navigation pane, choose .
-
On the Tags page, click Create Retention Policy.
-
In the Create Retention Policy dialog box, configure the parameters in the Cleanup Scope step and click Next.
Parameter
Description
Cleanup Scope
Clean up image tags by Instance, Namespace, or Repository.
-
Instance: Cleans up all repositories in the instance. Only tags matching the retention rules are kept.
-
Namespace: Cleans up all repositories in the namespace. Only tags matching the retention rules are kept.
-
Repository: Cleans up a specific repository within a namespace.
NoteIf you select Repository and then select only a namespace without specifying a repository, all repositories in that namespace are cleaned up.
Trigger Type
How tag deletion tasks run.
-
Automatic: Runs tag deletion tasks weekly or monthly.
-
Manual: You trigger deletion on demand. Manually trigger tag deletion tasks.
Trigger Cycle
Schedule for automatic execution: Every Week or Every Month.
NoteThis parameter is required only when Trigger Type is set to Automatic.
-
-
In the Retention Policy step, configure the parameters and click Create Retention Policy.
Parameter
Description
Keep recently pushed images
Required. Specify how many recently pushed images to keep.
Keep image tags
Optional. Specify additional image tag patterns to keep beyond the recently pushed count.
NoteDefaults to .* (retain all tags beyond the recently pushed count).
Manually trigger tag deletion tasks
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 that you want to manage.
-
In the left-side navigation pane, choose .
-
On the Tags page, find the target tag retention policy and click Execute in the Actions column.
-
In the Tips dialog box, click Confirm.
What to do next
Deleted image tags still occupy OSS storage. To free this space, run artifact deletion tasks. Clean up OSS buckets.