Wednesday, November 27, 2019

How to upload Docker images to Azure Container Registry - Hosting Docker images in Azure Container Registry

Azure Container Registry is a managed, private docker registry service. You can create and maintain Azure container registries to store and manage your private Docker container images.

It is alternative to Docker Hub. Azure Container Registry allows you to build, store, and manage container images and artifacts in a private registry for all types of container deployments.

Let us see how to upload a docker images from your VM into ACR.

Make sure you have docker installed on your VM.
Step 1 - Create Azure Container Registry (ACR)

Go to
Create a Resource, Give container registry as a name

Click on Create

Enter values as mentioned below:
Give registry name, resource group and choose Enable admin user and SKU as Basic 

 Click on Review and then create, now your container registry is been created.

Step 2 - Download sample Python App

Go to your machine where you have docker images stored. perform below command to download sample pythonapp which is already dockerized.
git clone 

cd  pythonApp

docker build . -t mypythonapp

type below command:
sudo docker images

this should show docker images you have created locally.

Now go to ACR, click on docker registry you created. Click on access keys under Settings.

Copy value under login server 

Step 3 - Upload your docker images to ACR
Login to Azure Container Registry through command line.
sudo docker login
Username: mydockerazureregistry

Enter password by copying value below password

Now tag the docker image per as below:
sudo docker tag mypythonapp

sudo docker push

That's it..Docker image is pushed into ACR. You can see it under Services--> repositories

How to connect to an EC2 instance from local machine after creating EC2 in AWS?

Find the steps to connect to EC2 instance (running in AWS) from your local machine .


1. Keys(for e.g., yourkey.pem) already downloaded in your local machine, preferably in Downloads folder.
2. EC2 is up and running
3. For windows laptop, you need to install Git by downloading from this URL -
4. For apple desktop or laptops, download

Steps to connect to EC2 instance:

1. Go to AWS console.
2. Click on EC2, click on running instances link

3. Select the checkbox of EC2 you would like to connect to.
4. Click on Action. Copy the url from SSH which looks like below:
For e.g.
ssh -i "mykey.pem"

5. Go to your local machine, Open Git bash, navigate to downloads directory like below:
For windows laptop --> cd downloads

steps For iMac only --> cd downloads
chmod 400 yourkey.pem

6. Paste the url from example highlighted above in step # 4.
ssh -i "mykey.pem"
7. say yes when it is asking to connect.
8. now you should be in AWS cloud, screen should tell you something like this:

Last login: Sun Feb 18 19:01:21 2018 from