A day with .Net

My day to day experince in .net

Pushing your local docker image to Azure Container Registry

Posted by vivekcek on March 18, 2018

In the last post, i wrote about how can we create and run Docker image locally.

Docker Hello World with ASP.NET Core

Today, i will show you how can we push this local Docker image to Azure Container Registry.Azure Container Registry is a private Docker Registry like Docker Hub, to which we can store our docker images.The Docker images stored in this registry can be deployed to a kubernetes cluster easily.

So what are the tools we required.

1. Docker CE.
2. Azure CLI.
3. Azure Subscription.

I am planning to use the Docker image created in the last post. So refer that post to create a docker image.
Before starting make sure Docker is running in your PC with admin privilege.

1. First go to Azure Portal.

2. Search for Azure Container Registry.

3. Create a container registry.Note down the name of the registry (Ex:vivekcek).

4. Once the registry is created, from the Acess Key tab note down the login server name (ex:vivekcek.azurecr.io).

5. Now open the command prompt as Administartor(Azure CLI must be installed).

6. Issue below command to login(Docker must be running for login).

az acr login --name vivekcek

7.Now list the available images in your docker.

docker ps

8. Now tag myapp image.

docker tag myapp vivekcek.azurecr.io/myapp:v1

9. Now push the taged myapp image.

docker push vivekcek.azurecr.io/myapp

10. Now in azure portal under Repository tab see your image.

Leave a comment