Skip to content
This repository has been archived by the owner on Nov 25, 2021. It is now read-only.

Latest commit

 

History

History
104 lines (83 loc) · 2.9 KB

AzureContainerRegistry.md

File metadata and controls

104 lines (83 loc) · 2.9 KB

Play with Azure Container Registry (ACR)

Commands

#The following variables will be used within the scope of the commands illustrated below:
RG=<your-resource-group-name>
ACR=<your-acr-name>
LOC=<your-acr-location>

#Create the resource group for the services for your ACR
az group create \
    -l $LOC \
    -n $RG

#Create your ACR
az acr create \
    --admin-enabled \
    --sku Basic \
    --verbose \
    -l $LOC \
    -n $ACR \
    -g $RG

#Show the info of your ACR
az acr show \
    -n $ACR

#Get your ACR's loginServer
az acr show \
    -n $ACR \
    --query loginServer

#Get your ACR's username
az acr credential show \
    -n $ACR \
    --query "username"

#Get your ACR's password
az acr credential show \
    -n $ACR \
    --query "passwords[0].value"

#Show usage of your ACR
az acr show-usage \
    -n $ACR

#Build an image by providing the code source (located in "." folder in the example below)
az acr build \
    --registry $ACR \
    --image <your-image-name>:<your-tag> \
    .

#Get the list of the repositories within your ACR
az acr repository list \
    -n $ACR

#Get tags of a repository within your ACR
az acr repository show-tags \
    -n $ACR \
    --repository <repository-name>

#Create a continuous integration build-task with GitHub
az acr build-task create \
    --registry $ACR \
    --name <build-task-name> \
    --image<your-image-name>:{{.Build.ID}} \
    --context <github-repository> \
    --branch master \
    --git-access-token <github-pat>

#Run a specific build-task
az acr build-task run \
    --registry $ACR \
    --name <build-task-name>

#View a build-task status and logs
az acr build-task logs \
    --registry $ACR

#List your ACR builds
az acr build-task list-builds \
    --registry $ACR \
    --output table

Notes

  • ACR is a great alternative to DockerHub for your private and enterprise containers registries
  • ACR has Geo-replication capabilities (in Preview) like explained here
  • ACR has Build capabilities (in Preview) like explained here, you could furthermore easily setup a base images update build.

Resources