Lab Objectives
By the end of this lab, you will:
- Understand how Azure Container Instances (ACI) works
- Create and deploy a containerized application using ACI
- Access and test the deployed container application
Pre-requisites
- An active Azure subscription
- Azure CLI installed locally
- Docker installed (optional, if building your own image)
Lab Steps
Step 1: Log in to Azure
bashCopyaz login
Step 2: Create a Resource Group
bashCopyaz group create --name myContainerRG --location eastus
Step 3: Deploy a Public Container Image
Let’s use the official mcr.microsoft.com/azuredocs/aci-helloworld
image.
bashCopyaz container create \
--resource-group myContainerRG \
--name mycontainerapp \
--image mcr.microsoft.com/azuredocs/aci-helloworld \
--cpu 1 --memory 1 \
--dns-name-label mycontainerappdemo123 \
--ports 80
🔹 Make sure the
--dns-name-label
is unique across Azure.
Step 4: Check the Container Status
bashCopyaz container show --resource-group myContainerRG --name mycontainerapp --query "{FQDN:ipAddress.fqdn, ProvisioningState:provisioningState}" --out table
Step 5: Access the Application
Visit the URL output in the FQDN field from the previous step, such as:
arduinoCopyhttp://mycontainerappdemo123.eastus.azurecontainer.io
You should see a simple web page with the message “Welcome to Azure Container Instances!”
Bonus: Deploy a Custom Docker Image from Docker Hub
If you have a custom image on Docker Hub:
bashCopyaz container create \
--resource-group myContainerRG \
--name customcontainerapp \
--image <yourdockerhubusername>/<imagename>:<tag> \
--dns-name-label customcontainerdemo123 \
--ports 80
Replace <yourdockerhubusername>/<imagename>:<tag>
with your actual image details.
Clean Up Resources
bashCopyaz group delete --name myContainerRG --yes --no-wait
Conclusion
You have successfully deployed a containerized application using Azure Container Instances. This is a fast and cost-effective way to run containers without managing VMs or orchestration platforms.
Leave a Reply