docker compose: 401 Unauthorized

Yuriy 0 Reputation points

Getting error when trying to build docker container:

/usr/bin/docker compose up -d

=> ERROR [server internal] load metadata for                                      0.1s ------                                                                                                                                                        > [server internal] load metadata for ------ failed to solve: failed to authorize: failed to fetch anonymous token: unexpected status from GET request to 401 Unauthorized

I can see two mentions of westcentral in source code:

  1. Dockerfile:
  2. values.yaml:


name: core

tag: latest



key: ${ TLS_KEY }

I was able to authorize successfully using

$ az login

but it didn't help.

Could you please kindly advise how to fix the error?

Azure Container Registry
Azure Container Registry
An Azure service that provides a registry of Docker and Open Container Initiative images.
407 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. deherman-MSFT 34,026 Reputation points Microsoft Employee

    It seems that you are getting an error when trying to build a docker container from an Azure Container Registry (ACR) image. The error indicates that you are not authorized to access the image from the registry. There are several possible causes and solutions for this issue:

    • Docker isn’t configured properly in your environment. You need to have a local Docker installation with a client version of 18.03 or later. You also need to login to the registry using docker login or az acr login commands. See Troubleshoot login to registry for more details.
    • The registry doesn’t exist or the name is incorrect. Make sure that the registry name crproductprodgermanywestcentral001 is correct and that the registry exists in your Azure subscription. You can use az acr list to see the available registries in your subscription.
    • The registry credentials aren’t valid. If you are using the admin user credentials, make sure that the admin user is enabled and that the username and password are correct. You can use az acr credential show to get the admin user credentials. If you are using a service principal or an Azure Active Directory (AAD) token, make sure that they have the appropriate permissions and scopes to access the registry and the image.
    • The registry public access is disabled or the network rules prevent access. If you have disabled the public network access to the registry or configured firewall or virtual network rules, you need to make sure that your client IP address or virtual network is allowed to access the registry. You can use az acr update to enable public network access or az acr network-rule to manage the network rules.

    This troubleshooting guide covers the majority of issues. Please check and see it resolves your issues.

    If you still have questions, please let us know in the "comments" and we would be happy to help you. Comment is the fastest way of notifying the experts.

    If the answer has been helpful, we appreciate hearing from you and would love to help others who may have the same question. Accepting answers helps increase visibility of this question for other members of the Microsoft Q&A community.

    Thank you for helping to improve Microsoft Q&A!

    User's image

    0 comments No comments