Azure Documentation

Azure Container Instances (ACI) Quickstart

This guide will walk you through the basics of deploying a containerized application using Azure Container Instances (ACI). ACI allows you to deploy containers without managing underlying virtual machines or orchestration platforms.

Prerequisites

Before you begin, ensure you have the following:

Step 1: Sign in to Azure

Open your terminal or command prompt and sign in to your Azure account:

Sign in

CLI
az login

This command will open a browser window for you to authenticate with your Azure credentials.

Step 2: Create a Resource Group

Azure resources are deployed within resource groups. Create a new resource group to hold your ACI instance:

Create Resource Group

CLI
az group create --name myResourceGroup --location eastus

Replace myResourceGroup with a unique name for your resource group and eastus with your desired Azure region.

Step 3: Deploy a Container Instance

Now, let's deploy a simple container. We'll use the microsoft/aci-helloworld Docker image, which displays a static HTML page.

Deploy Container

CLI
az container create --resource-group myResourceGroup --name my-aci-container --image microsoft/aci-helloworld --dns-name-label my-aci-helloworld --ports 80

This command creates a container instance named my-aci-container using the specified image. A DNS name label is assigned, and port 80 is exposed.

Step 4: View Container Information and Access the Application

After the deployment is complete, you can view the details of your container instance, including its IP address and FQDN (Fully Qualified Domain Name).

Get Container IP Address

CLI
az container show --resource-group myResourceGroup --name my-aci-container --query ipAddress.fqdn --output tsv

This command retrieves the FQDN of your container instance. You can then open this FQDN in your web browser to see the "Hello World" page.

Alternatively, you can get the IP address specifically:

Get Container IP Address (Specific)

CLI
az container show --resource-group myResourceGroup --name my-aci-container --query ipAddress.ip --output tsv

Important Notes

  • The --dns-name-label must be globally unique across all of Azure. If it's already taken, the deployment will fail.
  • ACI instances are billed by the second based on CPU and memory allocated.
  • You can deploy containers from various Docker image registries, including Docker Hub, Azure Container Registry, and others.

Step 5: Clean up Resources

Once you're done, it's good practice to clean up the resources you've created to avoid incurring further charges.

Delete Resource Group

CLI
az group delete --name myResourceGroup --yes --no-wait

This command deletes the resource group and all the resources within it.

Next Steps