AZURE CONTAINER INSTANCES (ACI)
Step-by-Step Guide to Deploy Azure Container Instances (ACI) π
Azure Container Instances (ACI) allows you to run containers without managing servers. Itβs a quick and easy way to deploy Docker containers in the cloud.
π οΈ Step 1: Sign in to Azure Portal
- Go to Azure Portal.
- Sign in with your Microsoft Azure account.
π¦ Step 2: Create an Azure Container Instance
- Click “Create a resource” (top left corner).
- Search for “Container Instances” and select “Create”.
π§ Step 3: Configure Basic Settings
β
Subscription: Select your Azure subscription.
β
Resource Group: Create a new one or use an existing one.
β
Container Name: Enter a unique name (e.g., myContainerInstance).
β
Region: Choose a data center closest to your users.
β
Image Source:
- Quick start image (for testing)
- Azure Container Registry (if using a private image)
- Docker Hub (for public images)
β Image Name: Use a public image (e.g., nginx:latest).
β OS Type: Choose Linux or Windows.
π Step 4: Configure Networking
β
DNS Name Label: Enter a unique label (e.g., mycontainer123).
β
Port: Enter 80 (if deploying a web app).
β
Restart Policy:
- Always (keeps running)
- Never (one-time execution)
- On failure (restarts on errors)
β Step 5: Review & Create
- Click “Review + Create”.
- Verify settings and click “Create”.
- Wait for the deployment to complete (~2 minutes).
π Step 6: Access Your Running Container
- Go to Azure Portal β Container Instances.
- Click on your container.
- Copy the FQDN (Fully Qualified Domain Name).
- Open it in your browser (http://mycontainer123.region.azurecontainer.io).
- π If using nginx, you should see the default Welcome to Nginx! page!
π» Step 7: Deploy a Custom Container via Azure CLI
Alternatively, you can create a container using Azure CLI.
- Login to Azure:
az login - Create a Resource Group (if not created earlier):
az group create –name MyResourceGroup –location eastus - Deploy a Container (Example: Nginx):
az container create –resource-group MyResourceGroup \
–name mynginxcontainer \
–image nginx \
–dns-name-label mynginx123 \
–ports 80
- Get Container Details:
az container show –resource-group MyResourceGroup –name mynginxcontainer –query ipAddress.fqdn –output tsv - Copy the URL and open it in a browser.
π Step 8: Manage & Scale Your Container
- View Running Containers:
az container list –output table - Check Logs:
az container logs –resource-group MyResourceGroup –name mynginxcontainer - Delete the Container (if no longer needed):
az container delete –resource-group MyResourceGroup –name mynginxcontainer
ποΈ Step 9: Cleanup Resources (To Avoid Costs)
- If you no longer need the container:
az group delete –name MyResourceGroup –yes –no-wait