AWS ECR Lifecycle Policy is not executed but works in test

Viewed 388

I set images Lifecycle policies to delete untagged images and images with a specific prefix

{
  "rules": [
    {
      "rulePriority": 1,
      "description": "Delete untagged images",
      "selection": {
        "tagStatus": "untagged",
        "countType": "sinceImagePushed",
        "countUnit": "days",
        "countNumber": 1
      },
      "action": {
        "type": "expire"
      }
    },
    {
      "action": {
        "type": "expire"
      },
      "selection": {
        "countType": "sinceImagePushed",
        "countUnit": "days",
        "countNumber": 5,
        "tagStatus": "tagged",
        "tagPrefixList": [
          "staging"
        ]
      },
      "description": "Delete old staging images",
      "rulePriority": 2
    }
  ]
}

I clicked "test rules" and dryRun shows all the affected images correctly. But it actually didn't delete any untagged images even after I waited for several days. What could be the reason? Why does it work in "test", but doesn't work for the repository itself?

The untagged images are created by docker buildx for multiple architectures. Like leftovers after the buildx pushes.

0 Answers
Related