Summary
In this Lab article we will create Azure Container Registry and upload Docker image. We will be using this same Azure Container Registry in Azure Container Instance and Azure Kubernetes Cluster Labs
Prerequisites
Azure subscription for Azure Container registry, Container Image and Azure CLI module for Windows
Step by Step process
1. Login to Azure Account
Az login
2. Show current subscription
az account show --output table
EnvironmentName HomeTenantId IsDefault Name State TenantId
—————– ———————————— ———– ————————————- ——- ————————————
AzureCloud 8cxxxx9f-xxxx-xxxx-xxxx-8axxxxxx078 True Pay-As-You-Go Enabled 8cxxxx9f-xxxx-xxxx-xxxx-8axxxxxx078
3. Create Resource Group for Azure Container Registry in East US region
az group create -n azureRepository -l eastus
4. Create ACR Repository with SKU: Basic
az acr create -n acrRepository -g azureRepository -l "East US" --sku basic --admin-enabled true
5. Connect to Azure Container Registry to list available ACR repository
az login
You have logged in. Now let us find all the subscriptions to which you have access…
Login to Azure Container Registry
az acr login -n "acrRepository"
Login Succeeded
List Azure Container Registry
az acr list -o table
NAME RESOURCE GROUP LOCATION SKU LOGIN SERVER CREATION DATE ADMIN ENABLED
————- —————- ———- —– ———————— ——————– —————
acrRepository azureRepository eastus Basic acrrepository.azurecr.io 2020-08-10T11:03:55Z False
6. To upload Docker Image on the Azure Container Repository, Tag Images with ‘Login Server” name {acrrepository.azurecr.io}
docker tag afa9d75a343e acrrepository.azurecr.io/portfolio:latest
List Docker Images
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
acrrepository.azurecr.io/portfolio latest afa9d75a343e 7 weeks ago 5.2GB
7. Push Docker Images to Azure Container Registry
docker push acrrepository.azurecr.io/portfolio:latest
8. Validate Image in the ACR registry :
az acr repository list -n "acrRepository" -o table
Result
———
portfolio
9. Delete Image from ACR repository
az acr repository list -n "acrRepository" -o table
Result
———
Portfolio
Show-tags assigned to Image
az acr repository show-tags -n Profile --repository poerfolio -o table
Result
——–
latest
Delete Image with tag: portfolio:latest
az acr repository delete -n "acrRepository" -t portfolio:latest
This operation will delete the manifest ‘sha256:xxxxxxxxxxxxxxxxxxxxxxxxxx’ and all the following images: ‘poerfolio:latest’.
10. Delete ACR resource group
az acr delete -g "acrRepository"