All Products
Search
Document Center

Container Registry:Delete image tags

Last Updated:Oct 22, 2026

Old image tags left by repeated builds continue to consume Object Storage Service (OSS) storage and incur extra fees. Tag retention policies in Container Registry (ACR) Enterprise Edition delete image tags that you no longer need in batches.

Configure a tag retention policy

After you configure a tag retention policy, image tags not retained by the policy are deleted.

Warning

Deleted image tags cannot be recovered. To restore a deleted image, rebuild it and push it again. Before you enable automatic deletion, verify that the retention scope and rules cover all image tags that you want to keep.

  1. Log on to the Container Registry console.

  2. In the top navigation bar, select a region.

  3. In the left-side navigation pane, click Instances.

  4. On the Instances page, click the Enterprise Edition instance that you want to manage.

  5. In the left-side navigation pane, choose Repository > Tags.

  6. On the Tags page, click Create Retention Policy.

  7. In the Create Retention Policy dialog box, configure the parameters in the Cleanup Scope step and click Next.

    Parameter

    Description

    Cleanup Scope

    The scope of image tags to delete. Valid values: Instance, Namespace, and Repository.

    • Instance: Applies to all repositories in the instance. Each repository retains the specified image tags.

    • Namespace: Applies to all repositories in the namespace. Each repository retains the specified image tags.

    • Repository: Applies to the specified repository. Select both a namespace and a repository.

      Note

      If you select Repository but specify only a namespace, the policy applies to all repositories in the namespace.

    Trigger Type

    How tag deletion tasks are triggered.

    • Automatic: Tag deletion tasks run on a weekly or monthly schedule.

    • Manual: Tag deletion tasks must be triggered manually. For more information, see Manually run a tag deletion task.

    Trigger Cycle

    The interval at which tag deletion tasks run automatically. Valid values: Every Week and Every Month.

    Note

    This parameter is required only when Trigger Type is set to Automatic.

  8. In the Retention Policy step, configure the parameters and click Create Retention Policy.

    Parameter

    Description

    Keep recently pushed images

    Required. The number of most recently pushed image tags to retain. Older image tags beyond this number are deleted.

    Keep image tags

    Optional. A regular expression that matches additional image tags to retain. Matching tags are retained regardless of the preceding number limit. Default value: .*, which retains all image tags. Examples:

    • release-v.*: Retains all tags that start with release-v. Use this pattern for release versions.

    • stable-.*: Retains all tags that start with stable-. Use this pattern for long-term stable versions.

Manually run a tag deletion task

  1. Log on to the Container Registry console.

  2. In the top navigation bar, select a region.

  3. In the left-side navigation pane, click Instances.

  4. On the Instances page, click the Enterprise Edition instance that you want to manage.

  5. In the left-side navigation pane, choose Repository > Tags.

  6. On the Tags page, find the target tag retention policy and click Execute in the Actions column.

  7. In the Tips dialog box, click Confirm.

What to do next

After image tags are deleted from an Enterprise Edition instance, the OSS bucket storage that they occupied is not released. To release the storage, run a garbage collection task. For more information, see Clean up OSS bucket storage.

FAQ

How do I clean up image tags from an ACR Personal Edition instance?

ACR Enterprise Edition and Personal Edition handle image tag cleanup differently:

  • Enterprise Edition: Supports tag retention policies. After you configure a policy, image tags not retained by the policy are deleted periodically. For more information, see Configure a tag retention policy.

  • Personal Edition: Does not support tag retention policies and cannot delete image tags automatically. Log on to the ACR console and manually delete the image tags that you no longer need on the repository page of the Personal Edition instance.