In this tutorial, we will learn how to push local container image to Azure container registry. You may refer this article to know more about container image creation: Create Container image
NOTE: We will use Azure CLI hence install Azure CLI version 2.0.29 or later. Run az --version to find the version.
Example:
Example:
Example:
To push a container image to Azure Container Registry, you must first tag the image with registry's login server.
Run the below commands:
Tag container image
Example:
Run docker images to validate tagging operation.
Example:
NOTE: We will use Azure CLI hence install Azure CLI version 2.0.29 or later. Run az --version to find the version.
- Select your subscription. Replace <<subscription ID>> with your subscription id
az account set --s <<subscription ID>>
- Create resource group
az group create --name <resourcegroup> --location <location>
Example:
az group create --name helloworldRG --location westeurope
- Create Azure Container registry. Replace <acrname> with unique ACR name
az acr create --resource-group <resourcegroup> --name <acrname> --sku Basic
Example:
az acr create --resource-group helloworldRG --name helloworldACR1809 --sku Basic
- Log in to container registry
az acr login --name <<acr name>>
Example:
az acr login --name helloworldACR1809
- Tag container image
To push a container image to Azure Container Registry, you must first tag the image with registry's login server.
Run the below commands:
docker images
Tag container image
docker tag <image> <acrLoginServer>/<image>:<tag>
Example:
docker tag helloworldapp helloworldacr1809.azurecr.io/helloworldapp:latest
Run docker images to validate tagging operation.
- Push Image
Example: docker push helloworldacr1809.azurecr.io/helloworldapp:latest
- Verify the container image in ACR
az acr repository list --name --output table
Example:
az acr repository list --name helloworldacr1809
Comments
Post a Comment
Thanks for your comment. In case of any concerns, please contact me at er.ashishsharma@outlook.com