Azure-docs: Problem with automatically purge images from an Azure container registry

Created on 3 Oct 2019  Â·  4Comments  Â·  Source: MicrosoftDocs/azure-docs

I'm trying to run scripts from this article.

I've prepared test repositories, little changed first example and try to run it:
az acr login --name myacrname $PURGE_CMD="mcr.microsoft.com/acr/acr-cli:0.1 purge \ --registry {{.Run.Registry}} --filter 'hello-world:.*'" az acr run \ --cmd "$PURGE_CMD" --registry myacrname --debug

The script is executing, it comes to "Packing source code into tar to upload ..." after that freezes and then tells "Access is denied: '\Documents and Settings'". Ok, I'm creating shortcut for "Documents and Settings". Run. Then it tells "Access is denied: '\$Recycle.Bin\S-1-5-21-705238614-490741011-620655208-39416\$RCEIG1Q'". Hmm.. Ok, I'm clearing $Recycle.Bin. Run. Now it tells me "Permission denied: '\hiberfil.sys'"

What am I doing wrong?

image


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri3 container-registrsvc cxp product-question triaged

All 4 comments

@Boombasteg Thanks for the feedback. We are investigating into the issue and will update you shortly.

Tried to run in Azure Cloud Shell:
image

command:
az acr run \ --cmd "mcr.microsoft.com/acr/acr-cli:0.1 purge --registry {{.Run.Registry}} --filter 'hello-world:.*'" --registry myacrname --debug

@Boombasteg - Thanks for your feedback. I notice you are running the command in a PowerShell environment. The examples in the article are formatted for a Bash shell, so need a little adaptation to run in PowerShell. A note should be added to the article.

So in your Cloud Shell example, the error is due to the '\' character which is used as a line break in Bash. This error can be resolved by removing the '\' line break, or substituting the PowerShell backtick '`'.

However, once you fix that, you'll see errors because of missing parameters in the purge command (needs an --ago parameter) and az acr run command (needs a source context). For example, I found the following worked in a PowerShell shell:

az acr run  --cmd "mcr.microsoft.com/acr/acr-cli:0.1 purge --registry {{.Run.Registry}}  --filter 'hello-world:.*' --ago 1d" --registry myregistry /dev/null

Please let us know if this helps? Thanks

Thank you Dan, your example is work!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

smcd253 picture smcd253  Â·  44Comments

andersgidlund picture andersgidlund  Â·  45Comments

Frankwayne picture Frankwayne  Â·  53Comments

DanijelMalik picture DanijelMalik  Â·  82Comments

jlorek picture jlorek  Â·  46Comments