Learn how to run Docker containers on Azure ACI like a professional. Our Docker Support team is here to answer queries and concerns.
Run Docker container on Azure ACI Like A Pro
ACI, short for Azure Container Instances, offers a fast and flexible way to run containers in the cloud without the overhead of managing virtual machines or orchestrators like Kubernetes.
It lets us focus on building and deploying your applications, while Azure takes care of provisioning and scaling the infrastructure behind the scenes.
Today, we will explore the Azure Container Instances, how to deploy them using both the Azure Portal and CLI, and how to manage and clean up our resources.
An Overview:
What are Azure Container Instances?
Azure Container Instances is a serverless container service on Microsoft Azure. It allows developers to deploy containerized applications quickly without managing VMs or container orchestrators. We can use standard Docker images from registries like Docker Hub or Azure Container Registry, and run containers directly from the Azure portal or CLI.
Here are some of the key benefits offered by ACI:
- No infrastructure management.
- Deploy containers in seconds.
- Supports Windows and Linux.
- Only pay for the resources we use.
Need to lock down access to your containers? Learn how to whitelist IPs in the Azure portal for an added layer of security.
How to Deploy a Container Instance via Azure Portal
- Start by logging into the Azure Portal https://portal.azure.com.
- Then, click Create a resource > Containers > Container Instances.
- On the Basics page, fill in the required details:
- Subscription
- Resource group: Create new > myresourcegroup
- Container name: mycontainer
- Image source: Quickstart images
- Container image: `mcr.microsoft.com/azuredocs/aci-helloworld:latest`
- OS type: Linux (or Windows)
- CPU/Memory size: Choose based on workload
- Now, click Next to go to Networking.
- Then, choose Public for DNS accessibility.
- Enter a unique DNS name label (e.g., `aci-demo`) and set DNS name label scope to Tenant for better security.
This configuration creates a public endpoint for our container:
http://<dns-name-label>.<region>.azurecontainer.io
Planning to integrate ACI with other Azure services? Azure Data Factory’s flatten hierarchy feature can help streamline data workflows within your containers.
- Next, click Review + Create, then Create. Wait for the deployment to complete.
- Once deployed, go to Resource Groups > myresourcegroup > mycontainer and click on the FQDN link to access the application in the browser.
View Container Logs via Azure Portal
We need to monitor logs and diagnose application issues. To view logs:
- First, go to the container instance.
- Then, go to Settings > Containers > Logs.
- Now, we will see HTTP GET request logs from browser interactions.
Encountering strange errors like read ECONNRESET
while integrating with Azure DevOps? This troubleshooting guide could help clarify the root cause.
Clean Up Resources via Portal
To avoid incurring unnecessary costs:
-
- Go to the Overview tab of the container instance.
- Then, click Delete, then confirm.
How to Deploy a Container Using Azure CLI
The prerequisites include Azure Cloud Shell (Bash) or we need to install Azure CLI locally.
- First, we need to create a Resource Group:
az group create --name myResourceGroup --location eastus
- Then, create the Container Instance
az container create \
--resource-group myResourceGroup \
--name mycontainer \
--image mcr.microsoft.com/azuredocs/aci-helloworld \
--dns-name-label aci-demo \
--ports 80
- To display Container info:
az container show \
--resource-group myResourceGroup \
--name mycontainer \
--query "{FQDN:ipAddress.fqdn,ProvisioningState:provisioningState}" \
--out table
- To view logs:
az container logs --resource-group myResourceGroup --name mycontainer
- Now, attach the Output stream:
az container attach --resource-group myResourceGroup --name mycontainer
- To clean up resources:
az container delete --resource-group myResourceGroup --name mycontainer
We can list all containers in a group with this command:
az container list --resource-group myResourceGroup --output table
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
Azure Container Instances make it easy to deploy and manage containers in the cloud with minimal overhead. It is an excellent solution for quick, scalable container deployments.
In brief, our Support Experts demonstrated how to run Docker containers on Azure ACI.
0 Comments