Yandex.Cloud
  • Services
  • Why Yandex.Cloud
  • Pricing
  • Documentation
  • Contact us
Get started
Yandex Container Registry
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Authentication in Yandex Container Registry
    • Managing a Docker image
      • Getting information about available Docker images
      • Creating a Docker image
      • Pushing a Docker image to a registry
      • Pulling a Docker image from a registry
      • Deleting a Docker image from a registry
    • Managing a registry
      • Getting information about existing registries
      • Creating a registry
      • Updating a registry
      • Deleting a registry
    • Managing a repository
      • Getting information about existing repositories
    • Managing policies for automatically deleting Docker images
      • Getting information about existing lifecycle policies
      • Creating a lifecycle policy
      • Updating a lifecycle policy
      • Performing lifecycle policy dry runs
      • Deleting a lifecycle policy
    • Working with roles
      • Assign a role
      • Viewing assigned roles
      • Revoke a role
  • Yandex Container Solution
  • Use cases
    • All use cases
    • Running a Docker image on a VM
  • Concepts
    • Overview
    • Docker image
    • Registry
    • Repository
    • Policies for automatically deleting Docker images
    • Backups
    • Quotas and limits
  • Access management
  • Pricing policy
  • API reference
    • Authentication in the API
    • gRPC
      • Overview
      • ImageService
      • LifecyclePolicyService
      • RegistryService
      • RepositoryService
      • ScannerService
      • OperationService
    • REST
      • Overview
      • Image
        • Overview
        • delete
        • get
        • list
      • LifecyclePolicy
        • Overview
      • Registry
        • Overview
        • create
        • delete
        • get
        • list
        • listAccessBindings
        • setAccessBindings
        • update
        • updateAccessBindings
      • Repository
        • Overview
        • get
        • list
        • listAccessBindings
        • setAccessBindings
        • updateAccessBindings
      • Scanner
        • Overview
  • Troubleshooting
  • Questions and answers
  1. Concepts
  2. Policies for automatically deleting Docker images

Policies for automatically deleting Docker images

  • Lifecycle policy statuses
  • Lifecycle policy rules
  • Resolving rule conflicts

A Docker image lifecycle policy lets you set rules for automatically deleting Docker images.

You can only set a lifecycle policy for each individual repository. This policy only applies to Docker images with names exactly matching the repository name. There is no support for prefix matching (nested repositories). You can't set a policy for a repository group, registry, folder, or cloud.

Lifecycle policy statuses

Note

The default policy is created with the DISABLED status.

A lifecycle policy can have the following statuses:

  • ACTIVE: The policy is active and regularly deletes Docker images according to the rules you set.
  • DISABLED: The policy is disabled and doesn't delete Docker images from a repository. You can use policies in this status to create and test rules.

A repository can only have one active policy and several disabled ones. You can disable the active policy at any time.

For both active and disabled policies, you can perform dry runs to check which Docker images will be deleted according to the rules.

Lifecycle policy rules

Before deleting Docker images, they're filtered by tag and then checked for compliance.

Warning

Specify at least one tag-based filter and set at least one delete condition.

To configure the lifecycle policy, set the following parameters:

  1. Filtering Docker images by tag:
    • tag_regexp: Flag for specifying a filter as a regular expression.

      A .* regular expression for tag_regexp means all images with tags. To make the rule apply to images without tags, explicitly set the untagged flag.

    • untagged: Flag indicating that the rule applies to Docker images without tags.

  2. Conditions for deleting Docker images:
    • expire_period: The period of time that must pass after creating a Docker image for it to suit the automatic deletion criteria. It must be a multiple of 24 hours.
    • retained_top: The number of Docker images (meeting the specified tag-based filter conditions) to be retained even if the expire_period already expired.

Resolving rule conflicts

  • If a Docker image filtered by tag only falls under a single delete rule, it's deleted according to the settings of this rule.
  • If a Docker image filtered by tag falls under several conflicting rules, it's deleted only if all the rules require it. If there is at least one rule saying that a Docker image shouldn't be deleted, it's retained.
In this article:
  • Lifecycle policy statuses
  • Lifecycle policy rules
  • Resolving rule conflicts
Language
Careers
Privacy policy
Terms of use
© 2021 Yandex.Cloud LLC