About Me

My photo
I am an MCSE in Data Management and Analytics, specializing in MS SQL Server, and an MCP in Azure. With over 19+ years of experience in the IT industry, I bring expertise in data management, Azure Cloud, Data Center Migration, Infrastructure Architecture planning, as well as Virtualization and automation. I have a deep passion for driving innovation through infrastructure automation, particularly using Terraform for efficient provisioning. If you're looking for guidance on automating your infrastructure or have questions about Azure, SQL Server, or cloud migration, feel free to reach out. I often write to capture my own experiences and insights for future reference, but I hope that sharing these experiences through my blog will help others on their journey as well. Thank you for reading!

How to pull - tag and push images from remote public registry to own ACR.

We will learn how to:

  • Download Docker images from a remote repository using the 'docker pull' command.
  • Give a downloaded image a new repository name and tag using the 'docker tag' command.
  • Login to a remote repository using the 'docker login' command.
  • Push a locally tagged image to a remote repository using the 'docker push' command.
  • Understand how to work with Azure Container Registry by specifying the specific repository name acruserakdev.azurecr.io/samples/
  • Understand how to specify the specific version of image by using the tag v1. 

First, we will use the command 'docker pull' to download the 'hello-world' image from the Microsoft Container Registry, or MCR.
 The command is 
    'docker pull mcr.microsoft.com/hello-world'. 
Next, 
 we will also pull the 'nginx' image with version 1.15.5-alpine using the command

 'docker pull mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpine'.

Now that we have these images downloaded, we will use the 'docker tag' command to give them a new repository name and tag. 
For the 'hello-world' image, the command is 
'docker tag mcr.microsoft.com/hello-world acruserakdev.azurecr.io/samples/hello-world:v1' 
and for
 'nginx' image the command is 
 'docker tag mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpineacruserakdev.azurecr.io/samples/nginx:v1'

Before we can push the images to the new repository, we need to login with the command 'docker login'. Then we will use the 'docker push' command to push the tagged images to the new repository. For the 'hello-world' image, the command is 'docker push acruserakdev.azurecr.io/samples/hello-world:v1' and for the 'nginx' image, the command is 'docker push acruserakdev.azurecr.io/samples/nginx:v1'. And that's it, we have successfully pulled and pushed Docker images with a new repository and tag."

docker pull mcr.microsoft.com/hello-world
docker pull mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpine
docker tag mcr.microsoft.com/hello-world acruserakdev.azurecr.io/samples/hello-world:v1
docker tag mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpine acruserakdev.azurecr.io/samples/nginx:v1

docker login

docker push  acruserakdev.azurecr.io/samples/hello-world:v1
docker push  acruserakdev.azurecr.io/samples//nginx:v1

No comments: