Bobcares

Run Docker container on Azure ACI Like A Pro

PDF Header PDF Footer

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

Run Docker container on Azure ACI Like A ProACI, 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.

 

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

  1. Start by logging into the Azure Portal https://portal.azure.com.
  2. Then, click Create a resource > Containers > Container Instances.
  3. 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
  4. Now, click Next to go to Networking.
  5. Then, choose Public for DNS accessibility.
  6. 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.ioCopy Code

    Planning to integrate ACI with other Azure services? Azure Data Factory’s flatten hierarchy feature can help streamline data workflows within your containers.

  7. Next, click Review + Create, then Create. Wait for the deployment to complete.
  8. 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:

  1. First, go to the container instance.
  2. Then, go to Settings > Containers > Logs.
  3. 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:

    1. Go to the Overview tab of the container instance.
    2. 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.

  1. First, we need to create a Resource Group:
    az group create --name myResourceGroup --location eastusCopy Code
  2. 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
    Copy Code
  3. To display Container info:
    
    az container show
    --resource-group myResourceGroup
    --name mycontainer
    --query "{FQDN:ipAddress.fqdn,ProvisioningState:provisioningState}"
    --out table
    Copy Code
  4. To view logs:
    az container logs --resource-group myResourceGroup --name mycontainerCopy Code
  5. Now, attach the Output stream:
    az container attach --resource-group myResourceGroup --name mycontainerCopy Code
  6. To clean up resources:
    az container delete --resource-group myResourceGroup --name mycontainerCopy Code

We can list all containers in a group with this command:

az container list --resource-group myResourceGroup --output tableCopy Code

[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

Submit a Comment

Your email address will not be published. Required fields are marked *

Get featured on the Bobcares blog and share your expertise with a global tech audience.

WRITE FOR US
Docker Support

Spend time on your business, not on your servers.

Managing a server is time consuming. Whether you are an expert or a newbie, that is time you could use to focus on your product or service. Leave your server management to us, and use that time to focus on the growth and success of your business.

TALK TO US Or click here to learn more.

Speed issues driving customers away?
We’ve got your back!