How to login into Azure Container Registry in Terminal

Caio Bonani 5 Reputation points
2023-11-16T12:57:48.8133333+00:00

I'm trying to log in my Container Registry to Push an Image to it.

Just doing az login (this command works fine) and then az acr login --name <my registry name>.

The second command gives me the error:

Error response from daemon: Get "https://<my registry name>.azurecr.io/v2/": dialing <my registry name>.azurecr.io:443 with direct connection: resolving host <my registry name>.azurecr.io: lookup <my registry name>.azurecr.io on <my router ip>:53: no such host

Login failed.

I've tried to use the --expose-token flag and do the docker login registry_name -u 0000......, but get the same error...

I already have an image pushed to my registry (made the same commands ), but this times the commands are not working.

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

3 answers

Sort by: Most helpful
  1. Caio Bonani 5 Reputation points
    2023-11-16T19:48:26.7+00:00

    After logout az logout, then logged in again, the command worked.

    1 person found this answer helpful.

  2. kobulloc-MSFT 26,131 Reputation points Microsoft Employee
    2023-11-16T17:10:22.45+00:00

    Hello, @Caio Bonani !

    Why am I getting a no such host error when attempting to login to Azure Container Registry?

    There are a variety of possible causes for this error (including CLI scenarios). This can be caused when:

    Azure Container Registry login troubleshooting guide:

    https://learn.microsoft.com/en-us/azure/container-registry/container-registry-troubleshoot-login

    If none of those are helpful, let us know in the comments so we can continue to troubleshoot this.


    I hope this has been helpful! Your feedback is important so please take a moment to accept answers.

    If you still have questions, please let us know what is needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!

    User's image

    0 comments No comments

  3. kobulloc-MSFT 26,131 Reputation points Microsoft Employee
    2023-11-16T19:59:52.0866667+00:00

    Answer reported by @Caio Bonani . Thank you!

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others", I'll repost your solution in case you'd like to "Accept" the answer.

    Issue:

    Pushing to the registry works however az acr login results in a no such host error.

    Solution by Caio Bonani:

    After logout az logout, then logged in again, the command worked.

    0 comments No comments