Understanding and using Azure Container Instances service - Multi-container Applications using Bicep
In the previous article, we looked at getting started with Azure Container Instances service, learned some basic concepts of ACI, and saw an example of provisioning a hello-world application. In this article, we shall extend this knowledge by provisioning a multi-container application to ACI using Bicep templates. You can also use a YAML method of provisioning multi-container applications to ACI. We shall look at this later.
As we learned earlier, a container group resembles a Kubernetes pod. The containers within the group share resources such as network and storage. The resource usage of containers can be controlled at the container group level. As a general rule of thumb, we should group containers with similar lifecycle and resource requirements into a container group. The multi-container groups are available for Linux containers only at the moment. Based on the region, there will be additional restrictions in terms of resource allocation.
Let us start with an example.
This example is like the earlier single-container ACI example. However, we are adding a second container in this multi-container group example. Each container within an ACI group can reference the other using localhost only. Therefore, in the example above, we are mapping the REDIS environment variable to
localhost instead of the name of the Redis container.
We can provision this ACI container group using the following Azure CLI command.
Output from the Bicep template gives us the IP address of the container group, which can be used to access the voting application that we just provisioned to the ACI container group.
This is it. In a future article, we shall see how to provision applications across multiple multi-container groups and what role virtual networks play in such a scenario.Share on: