In this article, Azure Cloud Shell (Azure CLI) is used to deploy and run a container in Azure Container Instances (ACI). ACI allows running and managing containers and applications easily without managing virtual machines. To deploy an image one can use provided images (Linux or Windows from Docker Hub), Azure container registry, or other image registry. After this exercise one will be able to create container resource group, specify container settings, and verify running containerized application in Azure.
Following tasks are performed:
Create resource
Create container
Verify running container
Clean up resources
Create Resource Group
The first step is to create Azure Container Instance resources using the Azure CLI. Azure CLI is a free Bash shell that can be run directly within the Azure portal. It is preinstalled and configured within an account.
Click the Cloud Shell button on the menu bar at the top right side of the Azure portal.
![Cloud Shell button]()
It will launch an interactive shell which can be used to run the steps outlined in this article. Select a Bash environment. To use code editor go to Settings menu in cloud shell toolbar and than select Go to Classic version.
![Cloud Shell Bash (Custom)]()
Create Resource Group - Resource group is a logical container used to hold related resources. It includes all resources which are required to manage as a group. az group create command creates a resource group. If a resource group is already created and exists then this step can be omitted and it can be use in next steps.
Syntax:
az group create \
--name <resource-group> \
--location <location>
az group create \
--name myResourceGroup1 \
--location eastus2
az account list-locations
az account list-locations --query "[*].name"
az account list-locations --query "[*].name" --out tsv | sort
Create Container
Let’s create container instance using Azure CLI. az container create command is used to create container instance. Command requires a container instance name, resource group name, and Docker container image. In this exercise mcr.microsoft.com/azuredocs/aci-helloworld public image is used. It is a small web application with one static HTML page and developed in Node.js.
To create a container instance run the below command . DNS name is used to expose container to Internet and it must be unique.
az container create \
--resource-group myResourceGroup1 \
--name myContainer1 \
--image mcr.microsoft.com/azuredocs/aci-helloworld \
--ports 80 \
--dns-name-label aci-example1
--location eastus2
--os-type Linux \
--cpu 1 \
--memory 1.5
It will take few minutes to complete the operation process and once it completes successfully one can verify it as mentioned in below section.
Verify running container
Azure CLI
Once container created successfully next task is to verify the container is running properly or not using az container show command as following. It shows the container’s build status.
az container show \
--resource-group myResourceGroup1 \
--name myContainer1 \
--query "{FQDN:ipAddress.fqdn,ProvisioningState:provisioningState}" \
--out table
Output: It displays fully qualified domain name (FQDN) of the container along with it’s state.
| FQDN | ProvisioningState |
|---|
| aci-example1.eastus2.azurecontainer.io | Succeeded |
Using Browser
One can access container's FQDN from a browser as below. This will be available only if ProvisioningState is Succeeded for the created container.
![FQDN from a browser]()
Pull container logs
az container logs command is used to pull out container instance logs. This is during application execution troubleshoot. The output displays the container’s logs and it shows HTTP GET requests generated while viewed the application in browser.
az container logs \
--resource-group myResourceGroup1 \
--name myContainer1
Output: It will give long result similar like as below.
listening on port 80
::ffff:10.242.254.51 - - [24/Nov/2025:10:30:35 +0000] "GET / HTTP/1.1" 304 - "-" ...
::ffff:10.242.254.51 - - [24/Nov/2025:10:40:10 +0000] "GET / HTTP/1.1" 304 - "-" ...
…
Clean up resources
Once finished the exercise it’s recommended to delete cloud resources are being created to avoid the unnecessary resource usage and any future costs. Deleting a resource group will delete all resources contained within it. Perform following steps one by one in to Azure Portal to clean up resources:
Navigate to resource group which is being created here and view it’s contents.
Delete resource group selection from the toolbar.
Choose resource group name and then follow next directions to delete resource group and all the resources it contains.
One can also clean up resources using Azure CLI as following:
Delete container - az container delete command is used to remove container.
az container delete \
--resource-group myResourceGroup1 \
--name myContainer1
Delete resource group - az group delete command is used to remove resource group, container registry, and container images.
az group delete \
--name myResourceGroup1
Summary
This article described how to create container group, specify container’s settings, and verify running containerized application in Azure. Following table summarizes the key commands used in this article:
| No | Operation | Command | Example |
|---|
| 1 | Create resource group | az group create | az group create --name myResourceGroup1 --location eastus2 |
| 2 | Create container | az container create | az container create --resource-group myResourceGroup1 --name myContainer1 --image mcr.microsoft.com/azuredocs/aci-helloworld --ports 80 --dns-name-label aci-example1 --location eastus2 --os-type Linux --cpu 1 --memory 1.5 |
| 3 | Verify running container | az container show | az container show --resource-group myResourceGroup1 --name myContainer1 --query "{FQDN:ipAddress.fqdn,ProvisioningState:provisioningState}" --out table |
| 4 | Pull container logs | az container logs | az container logs --resource-group myResourceGroup1 --name myContainer1 |
| 5 | Delete container | az container delete | az container delete --resource-group myResourceGroup1 --name myContainer1 |
| 6 | Delete resource group | az group delete | az group delete --name myResourceGroup1 |