How to run Docker Compose on Azure.
I have a local Linux Docker Compose project. I use docker-compose.yml
and docker-compose.override.yml
files to start 8 containers, all instances of different Docker images. Containers need to communicate with each other and be accessible on ports 80 / 443.
How can I set-up this Docker Compose project on Azure? I would expect Azure to make this effectively 'Serverless' to me.
Thank you.
Azure Container Registry
-
Chiugo Okpala • 80 Reputation points • MVP
2025-01-31T09:04:44.92+00:00 You can definitely set up your Docker Compose project on Azure and make it effectively 'Serverless' using Azure Container Instances (ACI). Here's a step-by-step guide to help you get started:
Step-by-Step Guide to Set Up Docker Compose on Azure
- Create an Azure Account:
- If you don't already have one, create a free Azure account.
- Install Azure CLI:
- Install the Azure CLI on your local machine if you haven't already. You can follow the instructions on the Azure website.
- Log in to Azure
- Open a terminal and log in to your Azure account using the command:
az login
- Follow the prompts to complete the authentication process.
- Create a Resource Group:
- Create a resource group to organize your Azure resources:
az group create --name myResourceGroup --location eastus
- Replace
myResourceGroup
with your desired name andeastus
with your preferred region.- Create a Container Group:
- Use the
az container create
command to create a container group from your Docker Compose file:az container create --resource-group myResourceGroup --name myContainerGroup --image "mcr.microsoft.com/azuredocs/aci-helloworld" --dns-name-label mydnslabel --ports 80 443
- Replace
myContainerGroup
with your desired name,mydnslabel
with your desired DNS name label, and adjust the image and ports as needed.
- Deploy Your Docker Compose File:
- Ensure your
docker-compose.yml
anddocker-compose.override.yml
files are configured correctly. - Use the
az container create
command to deploy your containers:az container create --resource-group myResourceGroup --name myContainerGroup --image "mcr.microsoft.com/azuredocs/aci-helloworld" --dns-name-label mydnslabel --ports 80 443
- Replace
myContainerGroup
with your desired name,mydnslabel
with your desired DNS name label, and adjust the image and ports as needed.
- Verify Deployment:
- Check the status of your container group:
az container show --resource-group myResourceGroup --name myContainerGroup
- You can also view the logs and interact with your containers using the Azure portal or Azure CLI.
By following these steps, you can set up your Docker Compose project on Azure and enjoy the benefits of a serverless deployment. This setup allows you to run your containers without managing any virtual machines, making it a cost-effective and efficient solution.
For more learning, see these microsoft learn documentation specific to your question.
https://learn.microsoft.com/en-us/azure/ai-services/containers/docker-compose-recipe
https://learn.microsoft.com/en-us/azure/container-instances/container-instances-overview
https://learn.microsoft.com/en-us/azure/container-instances/container-instances-quickstart
- Create an Azure Account:
-
Chris Taylor • 0 Reputation points
2025-01-31T12:40:54.88+00:00 Thank you for your reply. However, your example commands do not use a compose file (not that I can see). In fact they use an
--image
argument. I want to use a compose file. How can I define all my container services from a Compose file please? -
Deleted
This comment has been deleted due to a violation of our Code of Conduct. The comment was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
-
Srinud • 3,690 Reputation points • Microsoft Vendor
2025-02-03T18:10:40.3633333+00:00 Hi Chris Taylor,
Thank you for reaching out to us on the Microsoft Q&A forum.
In Azure, it is not possible to deploy an entire Docker Compose file at once. Instead of deploying an entire Docker Compose file, azure offers the Container Group feature, which allows you to deploy multiple containers on the same host.Please find the below document for more information:
https://learn.microsoft.com/en-us/azure/container-instances/container-instances-container-groupsIf the information is helpful, please consider by clicking the "Upvote" on the post.
If you have any further queries, please let us know in the comment. -
Srinud • 3,690 Reputation points • Microsoft Vendor
2025-02-04T18:26:05.6633333+00:00 Hi Chris Taylor,
I just wanted to check if you had a chance to review comment. If you found it helpful, could you kindly click the “upvote” on my post.If you have any further queries, please let us know in the comment.
Thank you.
-
Chris Taylor • 0 Reputation points
2025-02-05T07:00:08.2833333+00:00 Thank you for your comment. Let me review the article you have linked to.
-
Chris Taylor • 0 Reputation points
2025-02-05T07:45:00.2533333+00:00 How about this option:
Please take a look at section 7 under heading 'Create Azure resources'. In the screen-shot there is a step 'Create Web App' and an option to select a 'Single Container'. I haven't tested on Azure but is there also an option to select 'Multi-container'? It seems likely. And if there is a Multi-Container option there must be a Compose file of some sort.
Can you comment please.
-
Chris Taylor • 0 Reputation points
2025-02-05T08:39:58.6133333+00:00 This article, which defines containers with a YAML file, is similar to my Docker Compose experience https://learn.microsoft.com/en-us/azure/container-instances/container-instances-multi-container-yaml
Would I, for example, be able to mount and share a volume between the host and a container?
Would I be able to ssh into the host?
-
Srinud • 3,690 Reputation points • Microsoft Vendor
2025-02-06T09:49:48.8966667+00:00 Hi Chris Taylor,
Thanks for sharing the information.In web app it is not possible to deploy entire docker-compose file it is allow only individual docker images to deploy. when you use container group instances with a yaml file from the above link you can able ssh into the host.
-
Chris Taylor • 0 Reputation points
2025-02-07T09:11:09.2666667+00:00 What is the difference between Azure Container Group and Azure Kubernetes? Is Azure Kubernetes an alternative approach, for deploying my Docker Compose project to Azure?
-
Srinud • 3,690 Reputation points • Microsoft Vendor
2025-02-07T18:16:39.9133333+00:00 Hi @Chris Taylor,
Azure Container Instances (ACI) with Container Groups is a lightweight, serverless container deployment option that allows multiple containers to run together with shared networking and storage. It is best suited for simple workloads but does not provide full orchestration.On the other hand, Azure Kubernetes Service (AKS) is a fully managed Kubernetes service that offers auto-scaling, self-healing, advanced networking, and security features. It is ideal for large-scale, production-ready applications that require container orchestration.
If your application requires orchestration, scaling, and high availability, AKS is the better choice. However, if you need a quick, lightweight deployment for short-lived or simple workloads, ACI with Container Groups is a suitable option.
For more details, refer to the following documentation:
What is Azure Kubernetes Service (AKS)
Azure Container Instances - Container GroupsIf the information is helpful, please consider by clicking the "Upvote" on the post.
Thank you.
-
Srinud • 3,690 Reputation points • Microsoft Vendor
2025-02-10T17:06:53.1233333+00:00 Hi @Chris Taylor,
I just wanted to check if you had a chance to review comment. If you found it helpful, could you kindly click the “upvote” on my post.Thank you.
Sign in to comment