tencent cloud

Feedback

Auto-Deleting Image Tags

Last updated: 2024-12-02 14:30:05

    Overview

    Tencent Container Registry (TCR) supports the hosting and distribution of container images and provides the image building feature to enable image building, push, and hosting to be automatically triggered by code changes. If customers need to quickly iterate their applications, they can adopt an automated pipeline to generate images. Large number of image tags will be generated continuously, and the old image tags will no longer be used. If a single image repository contains too many image tags, the burden of tag management is huge, and the quota of image tags in the repository will be used up. Therefore, TCR provides the image tag retention feature to allow users to create custom rules for tag retention. Such rules can be triggered periodically to automatically delete the image tags that fall outside the retention scope.
    Tag retention rules support two types of retention policies: retaining the latest # tags pushed and retaining the tags pushed within # days, and simulated execution is supported.

    Notes

    The tag retention feature only allows users to delete the image tags that are no longer in use based on rules.

    Directions

    Creating tag retention rules

    1. Log in to the TCR console and click Tag Retention in the left sidebar. On the Tag Retention page, you can view the list of tag retention rules for the current instance. To change the instance, select the required instance name from the "Instance Name" drop-down list at the top of the page.
    2. Click Create Rule. In the Create tag retention rules pop-up window, configure the rule, as shown in the figure below:
    
    
    
    Associated Instance: Currently selected instance.
    Namespace: Namespace for which the tag retention rule will take effect. Currently, only one rule can be created for a single namespace.
    Retained Tags: By default, all repositories and tags in the namespace are retained and no filter is applied.
    Retention Rule: You can choose between Retain the most recently pushed # tags and Retain tags pushed within the last # days and specify the number of tags or days accordingly.
    Execution Period: Cycle for executing the tag retention rule. Manual, daily, weekly, and monthly execution are supported.
    Rule Switch: By default, the rule is enabled.
    3. Click Confirm to create the tag retention rule.

    Managing tag retention rules

    After successfully creating tag retention rules, you can view the created tag retention rules on the Tag Retention page. You can also perform the following operations to manage the rules. See the figure below:
    
    View the rule execution logs: You can click the name of a rule to view its triggering logs. For more information, see Viewing execution logs.
    Configure: You can reconfigure a tag retention rule but cannot modify the namespace for which it takes effect.
    Delete: You can delete a tag retention rule.

    Viewing execution logs

    1. Click the name of the target tag retention rule to view the triggering logs of the rule, as shown in the figure below:
    
    Task ID: ID of a tag retention task, unique within the instance.
    Creation Time: Time when a tag retention task was created.
    Time Spent: Time consumed to complete all the tag retention tasks.
    Execution Method: Manual or automatic. You can click Execute Now or Simulate Execution for manual execution. Automatic execution is based on the cycle specified in the tag retention rule.
    Execution Type: Real execution or simulate execution. Simulate execution can be used to confirm whether the rule is effective, but it does not actually clear image tags.
    Execution Status: Status of task completion.
    2. You can click a task ID to view the task details and click a specific repository to view its execution log.

    References

    You can also use the CreateTagRetentionRule API to create tag retention rules. For more information, see CreateTagRetentionRule.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support