1

We have some base images in private ACR and we would like to build images in other ACR using base images from the first registry. The build fails with authentication error.

Is there a way how to authorize az acr build agent to remote docker registry or different ACR?

dosmanak
  • 386
  • 2
  • 11
  • What is the type of authentication failure and type of OS? This might be helpful: https://stackoverflow.com/questions/55495223/push-docker-image-task-to-acr-fails-in-azure-devops-pipeline-with-unauthorized – Ecstasy Jul 15 '21 at 10:55
  • How could I put authetication fo `az acr build` command? – dosmanak Jul 19 '21 at 09:39
  • You can authenticate using [az acr build --auth-mode](https://learn.microsoft.com/en-us/cli/azure/acr?view=azure-cli-latest) This might be helpful: https://learn.microsoft.com/en-us/azure/container-registry/container-registry-faq#docker-push-succeeds-but-docker-pull-fails-with-error-unauthorized-authentication-required – Ecstasy Jul 19 '21 at 10:07
  • `--auth-mode {Default, None}` does not help at all. Do you have some additional info? I want the the acr task agent pool to be able to pull image from foreign private registry. The links provided does not help me. – dosmanak Jul 20 '21 at 09:38
  • You can refer to [Give identity pull permissions to base registry](https://learn.microsoft.com/en-us/azure/container-registry/container-registry-tutorial-private-base-image-update#give-identity-pull-permissions-to-base-registry) and [Create a task to track the private base image](https://learn.microsoft.com/en-us/azure/container-registry/container-registry-tutorial-private-base-image-update#create-a-task-to-track-the-private-base-image) – Ecstasy Jul 20 '21 at 11:52
  • [Tutorial: Automate container image builds when a base image is updated in another private container registry](https://learn.microsoft.com/en-us/azure/container-registry/container-registry-tutorial-private-base-image-update) – Ecstasy Jul 20 '21 at 11:52
  • Thank you for the links. I have read them. The guides require to have a task created, so I can assign it the credentials for it. And the task must have access to the context of git repository. I don't have access to the git repository, but I could run task manualy, so it could problem. But it doesn't solve the issue for the `az acr build` command itself – dosmanak Jul 20 '21 at 12:59
  • You can't directly use the build command to build an image in target registry from base image in base registry. Because az acr build supports only these source Locations: The local source code directory path (e.g., './src'), or the URL to a git repository(e.g. https://github.com/Azure-Samples/acr-build-helloworld-node.git) (https://learn.microsoft.com/en-us/cli/azure/acr?view=azure-cli-latest#az_acr_build) You can [Import container images to a container registry](https://learn.microsoft.com/en-us/azure/container-registry/container-registry-import-images) – Ecstasy Jul 22 '21 at 13:32
  • 1
    @DeepDave-MT ah, that seems like an answer for me. I already adopted the `az acr import` approach. If you put it as answer I will mark it accepted. Thank you very much. – dosmanak Jul 27 '21 at 09:49

1 Answers1

0

You can't directly use the build command to build an image in target registry from base image in base registry. Because az acr build supports only these source Locations: The local source code directory path (e.g. './src'), or the URL to a git repository(e.g. https://github.com/Azure-Samples/acr-build-helloworld-node.git)

You can Import container images to a container registry

az acr import \
  --name myregistry \
  --source docker.io/library/hello-world:latest \
  --image hello-world:latest
Ecstasy
  • 1,866
  • 1
  • 9
  • 17