You need to enable JavaScript to run this app.
Container Registry

Container Registry

Copy page
Download PDF
Tag retention rules management
Creating tag retention rules
Copy page
Download PDF
Creating tag retention rules
Tag management enables you to manage image tags automatically within an instance, namespace, or OCI artifact repository. Tags not covered by a retention policy are cleared automatically. This topic describes how to create a tag retention rule.​
tip​
This operation is supported for Standard Edition instances only and is not supported for proxy cache registries.​
Prerequisites​
You have created a CR instance. For details, see Creating Standard Edition instances.​
Procedure​
warning​
  • Images pushed for the first time have a 2-hour tag protection period and will not be cleared during this period.​
  • After a tag retention rule is executed, all image tags (both existing and new) that are excluded by the rule are cleared automatically.​
  • The storage space of cleared image tags is released within 1 to 5 hours after the task is completed.​
  • A maximum of 10 retention rules can be enabled. Any new rules created beyond this limit will be in a disabled state. To enable a new rule, first disable or delete an existing one.​
  1. Log in to the CR console.​
  1. In the left navigation bar, click Tag retention.​
  1. On the Tag retention rule page, click Create tag retention rules.​
  1. Enter the configuration information of the tag retention rule.​
  • Basic information​
  • ​
    Parameter​
    Description​
    Name​
    The custom name of the tag retention rule.​
    Description​
    Enter the description of the tag retention rule.​
    ​
  • Effective scope​
  • ​
    Parameter​
    Description​
    Effective level​
    The level at which the image retention rule is applied. Options: Instance, Namespace, and OCI artifact repository.​
    • Instance: Defines the image tag retention rule based on the instance dimension, and clears existing and new image tags not covered by the rule.​
    • Namespace: Defines the image tag retention rule based on the namespace dimension, and clears existing and new image tags not covered by the rule.​
    • OCI artifact repository: Defines the image tag retention rule based on the OCI artifact repository dimension, and clears existing and new image tags not covered by the rule.​
    Instance​
    Select the instance to which the retention rule applies.​
    Namespace​
    Select the namespace to which the retention rule applies.​
    OCI artifact repository​
    Select the OCI artifact repository where the retention rule takes effect. This option is available only when Effective scope is set to OCI artifact repository.​
    ​
  • Rule settings​
tip​
The retention rule is applied independently to each OCI artifact repository. For example, if you set the rule to retain the 30 most recently pushed tags, up to 30 tags are retained in each selected OCI artifact repository.​
  • ​
    Parameter​
    Description​
    Retention rule​
    You can combine the condition-based rule and the regex matching-based rule using OR or AND logic.​
    warning​
    • An image is considered Pull if a get manifest request exists. This includes scenarios where pipeline build uses a local cache, or where kubectl image pulls involves local cache. A head manifest request alone is not counted as a pull. Whether an image was recently pulled is determined by the pull time of the image tag.​
    • Not retained images cannot be recovered after cleanup. Do not configure pull-based retention policies if you are unsure about client behavior (such as whether local image caches are being used), as cleanup might cause service impact.​
    • By version count or days:​
    • By version count: Retains a specified number of the most recently pushed or pulled tags.​
    • By days: Retains tags that have been pushed or pulled within a specified number of days.​
    • Regular expression matching: Retains image tags that match the specified regular expression. The matching object of the regex pattern is the image tag name, such as latest or v1. For common regex matching examples, see Regular expression matching examples.​
    • Automatically delete empty OCI artifact repositories: When this feature is enabled, the system automatically deletes an OCI artifact repository when all its image tags are cleaned up based on retention rules.​
    Rule state​
    Specifies whether the tag retention rule is enabled or disabled.​
    Trigger rule​
    Select how the tag retention rule is triggered: manually or automatically on a schedule.​
    • Manual trigger: To clear specified image tags, you need to trigger the rule manually for execution.​
    • Timed trigger: Supports both manual and timed triggers. For a timed trigger, configure the following:​
    • First trigger time: Select the time for the first automatic cleanup of the images not covered by the rule.​
    • Trigger frequency: Select the trigger cycle for cleaning images.​
    ​
  1. After the configuration is complete, click Confirm.​
Last updated: 2026.09.23 14:37:23