How to authenticate docker to Azure Container registry

  1. Make sure your account has been added with at least read access to the acr (Azure Container Registry).
    1. Also if your account is a guest in the Azure Active Directory. Make sure you have completed your registration you'll get an email. A common error if you have not completed registration is Unable to find Subscription.
  2. Download the Azure cli and install it. You can download it for windows at https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-windows?view=azure-cli-latest. You can find install instructions for other OS's here https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest
  3. Now login to azure with the account that was setup in step 1. Use the command below and follow the screen instructions.
    1. az login 
  4. If you have multiple subscriptions you'll need to select the subscription the acr is in. 
    1. az account set --subscription <subscription guid>
  5. This step is optional but is usually needed. Install 'ACR Docker Credential Helper' full instructions can be found on github. Below are the commands to install it.
    1. Windows Powershell
      1. iex ([System.Text.Encoding]::UTF8.GetString((Invoke-WebRequest -Uri https://aka.ms/acr/installaad/win).Content))
    2. Linux and OS X
      1. curl -L https://aka.ms/acr/installaad/bash | /bin/bash
  6. Now login to your acr. <name> will be the part before .azurecr.io in the url to your acr.
    1. az acr login --name <name>
  7. Now you should be able to pull and push to your acr.
Note: The login to the acr does not last. It seams to only be valid for around  5 to 10 minutes. But its really easy to authenticate to again just re run step 6 above.

Comments

Popular posts from this blog

SXA and how I dealt with css/sass serialization conflicts

Kubernetes cluster on single board computers