acr-cli icon indicating copy to clipboard operation
acr-cli copied to clipboard

Purge behavior differs from documentation

Open pikausp opened this issue 4 years ago • 7 comments

Describe the bug When I attempted to purge untagged images using the

acr purge
    --registry <Registry Name>
    --filter <Repository Name>:<Regex filter>
    --untagged

I received the following error Error: required flag(s) "ago" not set. So I added --ago 0d and the command went through, but it also deleted tagged images. My filter was set to repname:.* as I assumed the tag filter was irrelevant when you specify the --untagged switch. Setting the filter to repname:^$ fixed the problem, but the --untagged is still required. Omitting this switch results in no images being deleted. Is this behaviour expected?

So the working command was

acr purge
    --registry <Registry Name>
    --filter <Repository Name>:^$
    --ago 0d
    --untagged

pikausp avatar Mar 02 '20 18:03 pikausp

In our process we rely heavily on "floating tags". The simplest of docker examples is the latest tag, this means we have a significant number of untagged manifests that it would be highly beneficial to be able to purge.

SailingYYC avatar Sep 21 '20 23:09 SailingYYC

I came here with the same problem but after carefully reading the documentation twice, I realized that the --untagged parameter does not mean that it would delete only untagged images. It is meant to delete untagged images if they are available.

--untagged - Specifies that manifests that don't have associated tags (untagged manifests) are deleted.

Still, I believe many of us read that documentation to find a way to purge only untagged images, not deleting all images. I would suggest that Microsoft update that doc to show how to purge only untagged images.

pitawatn avatar Jul 06 '21 14:07 pitawatn

Exactly this. This needs to be clarified in the documentation and we need some information on how to only delete untagged manifests, but leave the tags in place.

itpropro avatar Sep 09 '21 15:09 itpropro

I have the same problem.

I believe many of us read that documentation to find a way to purge only untagged images, not deleting all images.

I believe so too.

tsaeki-7bk avatar Dec 08 '21 00:12 tsaeki-7bk

@timja or @Wwwsylvia, can anyone take a look at this? The issue is nearly 2 years old.

itpropro avatar Jan 09 '22 00:01 itpropro

I’m pretty sure we do this via configuration in the registry, you can tell it do delete unstaffed manifests after x days

timja avatar Jan 09 '22 09:01 timja

My workaround on this is to set --ago=99999d.

johnlinvc avatar Mar 28 '22 06:03 johnlinvc