Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • 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
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Cloud Registry
  • Getting started
    • All guides
    • Creating a registry
    • Creating a lifecycle policy
  • Access management
  • Pricing policy
  • Terraform reference
  • Audit Trails events
  1. Step-by-step guides
  2. Creating a lifecycle policy

Creating a lifecycle policy

Written by
Sergey Kanunnikov
Updated at March 5, 2026
CLI
API

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

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id options.

  1. Prepare lifecycle policy rules and save them to a file named rules.json.

    Here is an example of a rules.json file containing a soft delete rule for Docker images with tags more than 30 days old, with a 10-day waiting period:

    [
      {
        "path_prefix": "ubuntu.*",
        "delete": {
          "type": "SOFT_DELETE",
          "cooldown_period_days": 10,
          "older_than_days": 30
        },
        "docker_filters": {
          "tag_status": "TAGGED"
        }
      }
    ]
    
  2. Create a lifecycle policy:

    yc cloud-registry registry lifecycle-policy create \
      --name <policy_name> \
      --description <policy_description> \
      --registry-id <registry_ID> \
      --state <policy_state> \
      --rules <path_to_rules.json>
    

    Where:

    • --name: Policy name.

    • --description: Policy description. This is an optional parameter.

    • --registry-id: ID of the registry for which you are creating the policy. There are quotas and limits on the number of lifecycle policies per registry.

    • --state: Policy state after creation: DISABLED or ENABLED.

      Note

      To avoid errors, we recommend creating a policy in DISABLED state and enabling it after checking the rules.

    • --rules: Path to the policy rule file in JSON format.

    Result:

    done (1s)
    id: e5oq6cd3fuue********
    name: my-lifecycle-policy
    description: My lifecycle policy
    rules:
      - path_prefix: ubuntu.*
        delete:
          type: SOFT_DELETE
          cooldown_period_days: "10"
          older_than_days: "30"
        docker_filters:
          tag_status: TAGGED
    state: DISABLED
    registry_id: e5o6a2blpkb6********
    created_at: "2026-01-21T14:47:01.061840Z"
    modified_at: "2026-01-21T14:47:01.061840Z"
    created_by: bfb7vsfljr3j********
    modified_by: bfb7vsfljr3********
    

To create a lifecycle policy, use the Create REST API method for the LifecyclePolicy resource or the LifecyclePolicyService/Create gRPC API call.

See alsoSee also

  • Configuring lifecycle policies
  • Lifecycle policy in Yandex Cloud Registry

Was the article helpful?

Previous
Creating a registry
Next
Installing and configuring Docker
© 2026 Direct Cursus Technology L.L.C.