Yandex Cloud
Search
Contact UsGet started
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • AI for business
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
Yandex Container Registry
  • Getting started
    • All guides
    • Installing and configuring Docker
    • Authentication in Container Registry
      • Getting information about existing lifecycle policies
      • Creating a lifecycle policy
      • Updating a lifecycle policy
      • Performing lifecycle policy dry runs
      • Deleting a lifecycle policy
    • Scanning Docker images for vulnerabilities
    • Creating a trigger for a registry
  • Yandex Container Solution
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Troubleshooting
  • FAQ
  1. Step-by-step guides
  2. Managing Docker image lifecycle policies
  3. Deleting a lifecycle policy

Deleting a lifecycle policy

Written by
Yandex Cloud
Updated at July 29, 2025
Management console
CLI
Terraform
API
  1. In the management console, select the folder where the registry was created.
  2. In the list of services, select Container Registry.
  3. Select the registry and click the row with its name.
  4. Select the repository and click the row with its name.
  5. In the left-hand panel, click Lifecycle.
  6. Click for the appropriate policy and select Delete.
  7. In the window that opens, click Delete.

If you do not have the Yandex Cloud CLI installed yet, install and initialize it.

  1. Delete the policy by specifying its ID:

    yc container repository lifecycle-policy delete <policy_ID>
    

    To find out the policy ID, get a list of lifecycle policies in a repository or registry.

  2. Make sure that the policy was deleted:

    yc container repository lifecycle-policy list --repository-name crp2hlbs67tj********/ubuntu
    

    Result:

    +----+------+---------------+--------+---------+-------------+
    | ID | NAME | REPOSITORY ID | STATUS | CREATED | DESCRIPTION |
    +----+------+---------------+--------+---------+-------------+
    +----+------+---------------+--------+---------+-------------+
    

If you do not have Terraform yet, install it and configure the Yandex Cloud provider.

  1. Open the configuration file and delete the fragment with the policy description:

    Sample policy description in the Terraform configuration
    resource "yandex_container_repository_lifecycle_policy" "my_lifecycle_policy" {
      name          = "best-policy"
      status        = "active"
      repository_id = "crpfvi6o4ra7********"
    
      rule {
        description   = "rule for applying policy"
        untagged      = true
        tag_regexp    = ".*"
        retained_top  = 1
        expire_period = "48h"
      }
    }
    
  2. Apply the changes:

    1. In the terminal, go to the directory where you edited the configuration file.

    2. Make sure the configuration file is correct using this command:

      terraform validate
      

      If the configuration is correct, you will get this message:

      Success! The configuration is valid.
      
    3. Run this command:

      terraform plan
      

      You will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.

    4. Apply the changes:

      terraform apply
      
    5. Type yes and press Enter to confirm the changes.

This will delete the lifecycle policy from the specified repository. You can check the deletion of the policy using the management console or this CLI command:

yc container repository lifecycle-policy list --registry-id <registry_ID>

To delete a policy, use the Delete method for the LifecyclePolicyService resource. Specify the policy ID in the lifecycle_policy_id parameter.

You can retrieve a list of policies using the List method for the LifecyclePolicyService resource.

Was the article helpful?

Previous
Performing lifecycle policy dry runs
Next
Scanning Docker images for vulnerabilities
© 2025 Direct Cursus Technology L.L.C.