5

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.

passwd
  • 2,883
  • 3
  • 12
  • 22
  • 1
    could you solve this problem? As for me, I tested my rules in the test area it seemed it would delete a lot of images, then I moved the test rules to the active rule area and I expected the rules to immediately delete images but it didn't. The deletion started about 20 minutes later but it worked as expected. – atavio Jun 08 '22 at 08:01
  • @atavio how do you move it to "active rule" area? I dont see such option. Only to test rules. But otherwise those rules just sit there doing nothing. – Andrius Nov 23 '22 at 15:38
  • Hi @Andrius, I just selected the test rule and clicked on the "Apply as lifecycle policy" button. – atavio Dec 02 '22 at 11:08
  • Interesting, I dont see such option. Though when I was moving it as test policy and back, after some time it started working. AWS workflow is kind of unintuitive.. – Andrius Dec 02 '22 at 12:11

1 Answers1

2

According to the first paragraph in the Lifecycle policies user guide

Affected images may take up to 24 hours to expire.

S3 life cycle policies also have the same behavior.