Guide: Dockerizing a Rental Application and Deploying to Azure Container Instances

Introduction

This guide will walk you through the process I used to containerize a rental application using Docker, push it to Azure Container Registry (ACR), and deploy it using Azure Container Instances (ACI).

Prerequisites

Before starting, ensure you have the following:

  1. Azure Account (with an active subscription)

  2. Visual Studio Code (VS Code) – Download from code.visualstudio.com

  3. Docker – Install from docker.com

  4. Azure CLI – Install from Microsoft Docs

  5. VS Code pluggins:

    • Azure CLI Tools (for managing Azure resources)

    • Docker pluggins (for managing containers)

Step 1: Dockerizing the Rental Application

1.1 Create a Dockerfile

Click Open folder

Select your rental folder, folder name (rental)

Create a file named Dockerfile

Type the following docker instructions inside the dockerfile to use Nginx as our base image, click terminal to our rental folder directory or path.

Run your docker desktop

Docker Desktop Provides the Docker Engine

  • The Docker Engine is the core runtime that builds, runs, and manages containers.

  • Without Docker Desktop you cannot execute commands like: docker run, docker build

    VS Code extensions rely on Docker Engine to interact with containers.

Step 2: Create Azure Container registry

Click the link to follow this step-by-step guide to set up your private Docker registry in Azure:

How to create a docker registry in azure container registry

After creating your docker register in azure copy the login server:rentalregistry.azurecr.io

Step 3: Build Docker image

Docker -- version (Show the version of docker installed)

Docker build -t (login server)/rental:latest .

Example: Doocker build -t rentalregistry.azurecr.io/rental:latest .

Docker image was built successfully

Use the command docker image ls to list our docker image details. such as repository, tag, image ID, time image was created and image size.

Step 4: Login into Microsoft Azure from our Terminal

To push docker image to Azure container registry we need to login into azure account and also login into our container registry on our terminal using the command az login.

A pops up screen appear, select your account and click the continue button to login into azure.

Successfully login into Azure

when you successfully login into Azure, you will see details such as Subscription name, Subscription ID and Tenant

Step 5 Push Docker image to Azure Container Registry (ACR)

Now that we have login into azure on our terminal using az login, We need to login into Azure Container registry using the command az acr login --name (registry name) . In this case our registry name is rentalregistry

Example: az acr login --name rentalregistry and use docker push rentalregistry.azurecr.io/rental:latest to push our image to azure container registry.

Step 6 verify your docker image is successfully push Azure container registry.

Login into azure and navigate to the search box type “container registry” you will see your Rentalregistry’

Click on your Rentalregistry and Click on service and Click on Repositories to see our image (rental).

Step 6 Deploy Rental application using Azure Container Instances (ACI)

Follow my step-by-step guide to deploy your our containerized rental app and make it accessible via web browser: using the link How to Deploy to Azure Container Instances

Conclusion

This project demonstrated how to modernize and streamline deployment of a rental application using Docker and Azure Container Services. By following the steps outlined:

Containerized the application using Docker for consistent, portable execution
Stored container images securely in Azure Container Registry (ACR)
Deployed effortlessly using Azure Container Instances (ACI) - no VM management required
Achieved web accessibility with automatic public IP/DNS assignment

0
Subscribe to my newsletter

Read articles from SUBAIR NURUDEEN ADEWALE directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

SUBAIR NURUDEEN ADEWALE
SUBAIR NURUDEEN ADEWALE

Hello! I'm Subair Nurudeen Adewale, a cloud computing enthusiast and the founder of Nucloud Blog. I'm passionate about sharing knowledge and insights on cloud infrastructure, security, innovation, and the intersection of technology and design. As a cloud expert with a keen eye for user experience, I explore the latest trends and best practices in UI/UX, and how they can be applied to create intuitive, user-friendly, and seamless experiences for cloud-based applications and services. Follow Nucloud Blog for the latest updates and insights from the world of cloud computing and UI/UX design.