Version Retention

CCR

  • Enterprise Edition API Reference
    • Appendix
    • Common Headers and Error Code
    • Enterprise Edition Instance APIs
    • Helm Chart Management Interface
    • Image access control APIs
    • Image Access Credential APIs
    • Image API
    • Image Migration APIs
    • Image On-demand Loading APIs
    • Image Registry APIs
    • Image Synchronization APIs
    • Namespace APIs
    • Overview
    • Service domain
    • Trigger APIs
  • Enterprise Edition Go-SDK
    • Enterprise Edition Instance
    • Initialization
    • Install the SDK Package
    • Overview
  • Enterprise Edition Operation Guide
    • Access configuration
      • Configure Access credentials
      • Configure Custom Endpoint
      • Configure IAM Access Control
      • Configure IAM Tag Permission Policy
      • Configure Robot Account
      • Network Access Control
        • Configure public network access control
        • Configure virtual private cloud access control
        • Network Access Control Overview
    • Container DevOps
      • Manage Trigger
    • Create Enterprise Edition Instance
    • Distribution Management
      • Cross-Instance Synchronization of Image
      • On-Demand Loading of Container Image
      • Using P2P Acceleration in CCE Clusters
    • Event notification
      • Configure Event Notification Alert
      • Image Push Failure Error Code and Handling Methods
    • Image Build
      • Build Based on Existing Image
    • Image Cleanup
      • Clean BOS Storage Space
      • Delete image version
      • Version Retention
    • Image Migration
      • Migrate External Image to Enterprise Edition Instance
    • Image security
      • Immutable image version
      • Security Scanning Container Image
    • Manage Namespace
    • OCI Artifact Management
      • Manage Helm Chart
      • Manage Image Registry
      • OCI Artifact Management Overview
  • Function Release Records
  • Personal Edition API Reference
    • Helm API
    • Image API
    • Image Migration APIs
    • Image Version and Image Version Scanning Interface
    • Namespace APIs
    • Overview
    • User APIs
  • Personal Edition Documentation Set
    • Account Permission Management
    • Cloud Container Engine (CCE) migration to CCR
    • Container Image Service Basic Operations
    • How to Perform Image Scanning
    • How to Upload Helm Chart
    • How to use the DockerHub image accelerator
  • Product Announcement
    • CCR Enterprise Edition Pricing Announcement
    • CCR Enterprise Edition Public Beta Announcement
    • CCR Personal Edition Announcement on Closing New Entry
    • CCR Personal Edition Announcement on Disabling Image Scanning Function
  • Product introduction
    • Core concepts
    • Enterprise Edition Different Specifications Differentiation Description
    • Key functions
    • Product advantages
    • Product Introduction
  • Product pricing
    • Billing overview
  • Quick Start
    • Enterprise Edition Quick Start
    • How to Build Docker Image
  • Service Level Agreement (SLA)
    • CCR Enterprise Edition Service Level Agreement
All documents
menu
No results found, please re-enter

CCR

  • Enterprise Edition API Reference
    • Appendix
    • Common Headers and Error Code
    • Enterprise Edition Instance APIs
    • Helm Chart Management Interface
    • Image access control APIs
    • Image Access Credential APIs
    • Image API
    • Image Migration APIs
    • Image On-demand Loading APIs
    • Image Registry APIs
    • Image Synchronization APIs
    • Namespace APIs
    • Overview
    • Service domain
    • Trigger APIs
  • Enterprise Edition Go-SDK
    • Enterprise Edition Instance
    • Initialization
    • Install the SDK Package
    • Overview
  • Enterprise Edition Operation Guide
    • Access configuration
      • Configure Access credentials
      • Configure Custom Endpoint
      • Configure IAM Access Control
      • Configure IAM Tag Permission Policy
      • Configure Robot Account
      • Network Access Control
        • Configure public network access control
        • Configure virtual private cloud access control
        • Network Access Control Overview
    • Container DevOps
      • Manage Trigger
    • Create Enterprise Edition Instance
    • Distribution Management
      • Cross-Instance Synchronization of Image
      • On-Demand Loading of Container Image
      • Using P2P Acceleration in CCE Clusters
    • Event notification
      • Configure Event Notification Alert
      • Image Push Failure Error Code and Handling Methods
    • Image Build
      • Build Based on Existing Image
    • Image Cleanup
      • Clean BOS Storage Space
      • Delete image version
      • Version Retention
    • Image Migration
      • Migrate External Image to Enterprise Edition Instance
    • Image security
      • Immutable image version
      • Security Scanning Container Image
    • Manage Namespace
    • OCI Artifact Management
      • Manage Helm Chart
      • Manage Image Registry
      • OCI Artifact Management Overview
  • Function Release Records
  • Personal Edition API Reference
    • Helm API
    • Image API
    • Image Migration APIs
    • Image Version and Image Version Scanning Interface
    • Namespace APIs
    • Overview
    • User APIs
  • Personal Edition Documentation Set
    • Account Permission Management
    • Cloud Container Engine (CCE) migration to CCR
    • Container Image Service Basic Operations
    • How to Perform Image Scanning
    • How to Upload Helm Chart
    • How to use the DockerHub image accelerator
  • Product Announcement
    • CCR Enterprise Edition Pricing Announcement
    • CCR Enterprise Edition Public Beta Announcement
    • CCR Personal Edition Announcement on Closing New Entry
    • CCR Personal Edition Announcement on Disabling Image Scanning Function
  • Product introduction
    • Core concepts
    • Enterprise Edition Different Specifications Differentiation Description
    • Key functions
    • Product advantages
    • Product Introduction
  • Product pricing
    • Billing overview
  • Quick Start
    • Enterprise Edition Quick Start
    • How to Build Docker Image
  • Service Level Agreement (SLA)
    • CCR Enterprise Edition Service Level Agreement
  • Document center
  • arrow
  • CCR
  • arrow
  • Enterprise Edition Operation Guide
  • arrow
  • Image Cleanup
  • arrow
  • Version Retention
Table of contents on this page
  • Note
  • Prerequisites
  • Operation steps
  • Simple mode
  • Advanced mode
  • Reference for version retention configuration
  • Regular expression
  • Typical scenarios
  • FAQ

Version Retention

Updated at:2025-11-03

While using CCR, rapid iterations in your business often lead to the generation of numerous image versions. Over time, many outdated versions become obsolete. These redundant images not only accumulate storage costs but also complicate image management. You can utilize the version retention feature for regular cleanup.

Note

  • By creating retention rules, image versions not covered by the rules will be automatically deleted when the rules are executed. Note: The version retention feature does not automatically free up storage space. To clean up storage space, please configure an artifact cleanup policy. For details, see: Artifact Cleanup
  • Once the version retention rules are executed, deleted image versions cannot be re-pulled. To prevent accidental deletions, it is advisable to simulate the execution for critical images first. Proceed with the official execution only after fully understanding the scope of the cleanup.
  • In some situations, different image versions in a repository may correspond to the same artifact. If one image version satisfies the cleanup criteria during rule execution, all versions linked to the same artifact will be deleted.
  • It is not recommended to manually delete versions during retention rule execution, as this can lead to discrepancies between the retained versions and your expectations.

Prerequisites

  • Successfully Create Enterprise Edition Instance.
  • At least one image registry must exist in the instance. For details, refer to Manage Image Registry.

Operation steps

  1. Sign in to Baidu AI Cloud Console and select Product Service > Cloud Container Registry > CCR.
  2. Go to the target instance, click on Repository Management, and select Version Retention.
  3. Click the Create Rule button. After choosing a namespace, you can opt to create a retention rule via simple mode or advanced mode.

Simple mode

  • Retained versions: By default, all repositories and versions in the namespace are included.
  • Retention policy: Supports the following options (choose as needed): Retain the latest n pushed versions; retain versions pushed within n days; retain the latest n pulled versions; retain versions pulled within n days.
  • Execution cycle: Options include manual execution, daily, weekly, or monthly execution. Daily: 00:00 every day; weekly: 00:00 every Monday (default); monthly: 00:00 on the 1st day of each month.

Advanced mode

  • Repository filtering and version filtering: Supports regular expression matching.
  • Retention policy: Supports the following options (choose as needed): Retain the latest n pushed versions; retain versions pushed within n days; retain the latest n pulled versions; retain versions pulled within n days.
  • A maximum of 15 retention rules can be set. The final result is the union of multiple rules.
  • Execution cycle: Options include manual execution, daily, weekly, or monthly execution. Daily: 00:00 every day; weekly: 00:00 every Monday (default); monthly: 00:00 on the 1st day of each month.

Once the rule is successfully created, you can view it on the Version Retention page and perform actions such as execution, editing, or deletion of existing rules.

Reference for version retention configuration

Regular expression

When configuring version retention rules in advanced mode and filling in the Repository and Version filter rules, the regular expressions support the following matching rules:
*: Matches any string of any length that does not contain the path separator (/).
**: Matches any string of any length, including the path separator (/).
Note:
** must be used as a complete relative path. For example, using /ccr** is equivalent to /ccr and only matches first-level repositories prefixed with “ccr”. To match all repositories under “ccr”, use /ccr/**; to match all repositories prefixed with “ccr”, use /ccr/**.
?: Matches any single character except /.
{str1, str1, …}: Matches multiple regular expressions simultaneously.

Typical scenarios

Filter type Scenario Regular expression
Repository filter Match all image repositories in the current namespace ** or leave blank
Match all first-level repositories prefixed with “ccr” in the selected namespace ccr*
Match all first-level repositories prefixed with “ccr1” and “ccr2” in the selected namespace {ccr1, ccr2}
Match all repositories under the “ccr1” and “ccr2” directories in the selected namespace {ccr1, ccr2}/**
Match all repositories prefixed with “ccr1” and “ccr2” in the selected namespace {ccr1, ccr2}*/**
Version filter Match all 1.x version tags in the selected repository 1.?
Match all version tags prefixed with “dev1” and “dev2” in the selected repository {dev1, dev2}

FAQ

1. How to view retention results?
Details are shown below: image.png RETAIN: The corresponding image version will be retained.
DEL: The corresponding image version will be automatically deleted.
2. How to ensure that image cleanup does not accidentally delete important images?
Before executing image cleanup, it is recommended to perform a simulated execution to confirm the scope of images to be deleted and the cleanup time, ensuring no critical images are accidentally removed.

Previous
Delete image version
Next
Image Migration