Deploy Docker Images from Azure Container Registry to web app

In this blog, I am going through the steps needed to pull a docker image from your laptop to azure container registry and to publish the image as a web application

  1. Create an account in docker hub: Go to https://hub.docker.com/ and create an account 
  2. Install Docker Desktop for Windows in your computer from the following link: https://hub.docker.com/editions/community/docker-ce-desktop-windows

If you have a windows computer, make sure to select Linux containers during installation or after the installation is finished

3. Open Windows PowerShell and connect docker repository: For this, go to the docker installed folder in PowerShell and type the following command. Use the username and password you created in step1

docker login -u yourusername -p yourpassword

For successful login you can see ‘Login Succeeded’ message in Powershell

4. Pull a sample docker image from docker hub for this test purpose: I am going to pull nginx for our test

Type the following command

docker pull nginx

5. Create a container registry in Azure: Go to Container registries in Azure portal and create a new registry. Once the creation is done, go to ‘Access Keys’ and enable the Admin User. This will provide the login details (username, two passwords). I have created a repository with registry name as cloudcompute. So, the full login server name is cloudcompute.azurecr.io

6. Create an Alias of the image: Create an alias of the Image with the name identical to the login server name. Run the following command in PowerShell

docker tag nginx cloudcompute.azurecr.io/samples/nginx

If you run docker image ls, you can now see two images

6. Login to the Azure container registry: Run the following command from PowerShell. Here we use the login server name. When asked, type the username and one of the password you finds at ‘Access Keys’ section of container registry

docker login cloudcompute.azurecr.io

Make sure the login is successful . You can see ‘Login Succeeded’ message

7. Push the Image to Azure Container registry: Run the following PowerShell cmdlet

docker push cloudcompute.azurecr.io/samples/nginx

8. Verify the repository: Now, you can verify the Azure registry as below:

9. Deploy the Image to WebApp: You can get the option as below:

Follow the steps with your preferred names, region, etc. I finally deployed the nginx as a web app as below:

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Leave a Reply

Your email address will not be published. Required fields are marked *

Bitnami