Yandex Cloud
Documentation
PresentationContact UsTry it for free
© 2026 Direct Cursus Technology L.L.C.
Yandex Cloud Registry
  • Getting started
    • All guides
      • Lifecycle policy
      • Scanning a registry
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  1. Step-by-step guides
  2. Managing a registry
  3. Lifecycle policy

Creating a lifecycle policy

Written by
Sergey Kanunnikov
Updated at November 2, 2026
View in Markdown
CLI
API

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

The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id.

If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  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 setting.

    • --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.

Useful linksUseful links

  • Configuring lifecycle policies
  • Lifecycle policy in Yandex Cloud Registry

Was the article helpful?

Previous
Delete access policy
Next
Scanning a registry
© 2026 Direct Cursus Technology L.L.C.