Copy Docker Container Images to Azure Private Registry
Today in this article, we will see how to Import or copy Docker Container Images to Azure Private Registry using step by step guide.
Here you can use simple Azure CLI or Power CLI commands to copy or import ready images from a public registry like DockerHub.
We will see below how to import the Docker Images from DockerHub without using any docker commands.
Getting started – Import from Docker Hub
Please login to the Azure Cloud subscription account and have a resource group ready so as to use this feature.
Step 1- Create Azure container registry
If you already have ACR created you can skip this step.
Let’s use the below steps to create an Azure Container registry.
Command
az acr create --resource-group myResourceGroup --name myRegistry --sku Basic
Example
az acr create --resource-group thecodebuzz-group --name TheCodeBuzzRegistry --sku basic
Step 2- Import Image from Docker Hub
I have the below images in the remote Docker hub.
Command
az acr import --name myRegistry --source docker.io/<repo-name>/<image-name>:<tag-name> --image <image-name>:<tag-name>
OR
If You need to use a Docker username and password for authentication,
az acr import --name myRegistry
--source docker.io/<repo-name>/<image-name>:<tag-name> --image <image-name>:<tag-name> --username <username> --password <password>
Example
az acr import --name TheCodeBuzzRegistry --source docker.io/firstthecodebuzz/forazureacr:v1 --image forazureacr:v1 --username firstthecodebuzz --password *****
Once executed you shall be able to import the image into the Azure private registry. Please wait some time to get the import finished successfully.
Verify or List container images from Azure Registry
Please use the below command to list and verify available images in the Azure registry,
Command
az acr repository list --name myRegistryName --output table
Example
az acr repository list --name thecodebuzzregistry --output table
OR
az acr repository list --name thecodebuzzregistry.azurecr.io --output table
Finally, you shall see that your docker image was successfully imported from the docker hub to the Azure private registry.
References:
Do you have any comments or ideas or any better suggestions to share?
Please sound off your comments below.
Happy Coding !!
Please bookmark this page and share it with your friends. Please Subscribe to the blog to receive notifications on freshly published(2024) best practices and guidelines for software design and development.