Skip to content

Instantly share code, notes, and snippets.

@berndverst
Created January 16, 2018 07:24
Show Gist options
  • Save berndverst/b1b0bf8c72e232e96a595f6a6fb22b58 to your computer and use it in GitHub Desktop.
Save berndverst/b1b0bf8c72e232e96a595f6a6fb22b58 to your computer and use it in GitHub Desktop.
Docker Login Help for Azure Container Registries. Add to your BASH or ZSH .rc file
alias acr-login="echo 'Fetching available Azure container registries...'; az acr list -otable --query='[*].{Name:name,Group:resourceGroup,Location:location}'; echo '\nEnter registry name:'; read azregistry; az acr credential show -n \$azregistry --query='[passwords[0]][0].value' -otsv | docker login -u \$azregistry --password-stdin \$azregistry.azurecr.io"
@berndverst
Copy link
Author

berndverst commented Jan 16, 2018

Add this to your ~/.zshrc, ~/.bashrc or ~/.bash_profile.

Note: this require registries to be admin-enabled. You can do so via az acr update --name $azregistryname --admin-enabled true where $azregistryname is the name of your container registry.

Example:

> acr-login
Fetching available Azure container registries...
Name                  Group                  Location
--------------------  ---------------------  -------------
draftregistry         kubegroup              westus
TechSummitSGRegistry  techsummit-sg          southeastasia
centralregistry       centralcontainergroup  centralus

Enter registry name:
> TechSummitSGRegistry
Login Succeeded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment