I am trying to create a scheduled ACR task to delete old images from storage using this command:
PURGE_CMD="acr purge --filter 'worker:.*' --untagged --ago 1d"
az acr task create --name remove_old_images_worker --cmd "$PURGE_CMD" --schedule
"0 0 * * *" --registry registry --context /dev/null
But it returns me an error with this:
acb.yaml does not exist.
And what is also interesting is that it worked for a similar task just a couple of days ago.
2
Answers
After some investigation, I solved this problem using Terraform as follows:
The error message "acb.yaml does not exist" implies that the Azure CLI is expecting to find an
acb.yaml
file in the context location you’ve specified. If you’re specifying/dev/null
as the context, it’s unclear why the CLI would expect to find a file there unless there’s a bug or a temporary issue with the CLI or the ACR service. When creating scheduled tasks in Azure Container Registry (ACR) using the Azure CLI, the--context
parameter is used to specify the location of the source code, which typically contains aacb.yaml
However, for a purge task that only runs a command without needing a build context, you should use the special value
--context /dev/null
.Instead of using
/dev/null
, try using a dummy context with an emptyacb.yaml
file:Needless to say below things must be ensured first.
can create in your ACR.
Additionally, make sure that you are running the command in the correct directory where the
acb.yaml
file is located. If you are running the command from a different directory, you may need to specify the full path to theacb.yaml
file using the--context
parameter.References: