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:
- An Azure account. If you don't have one, create a free account.
- The Azure CLI installed and configured. You can install it from here.
Step 1: Sign in to Azure
Open your terminal or command prompt and sign in to your Azure account:
Sign in
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
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
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
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)
Important Notes
- The
--dns-name-labelmust 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
This command deletes the resource group and all the resources within it.
Next Steps
- Learn more about ACI Features.
- Explore deploying Docker Compose applications with ACI.
- Integrate ACI with other Azure services like Virtual Networks.