Azure Container Instances - Features And When To Use Them

When should you choose to use Azure Container Instances? 

Sometimes we have containerized workloads that require us to permanently run containers. There could be a website or a database in a container that needs to be continuously running. However, long-running containers are not cost-effective to host on Azure Container Instance because they end up costing twice as much as just hosting in a virtual machine.
Suppose I want to perform a continuous integration build using a Docker container and a build happens every time I push code to my central repository. If my build takes 10 minutes and if I commit code twice daily on weekdays, it means I am going to do 40 builds and take a total of 400 minutes. So if I want to allocate a build container that has 4 GB of RAM and 2 core then 400 minutes with ACI would only cost me around ₹ 68 approximately. But if I use a virtual machine for the same, it would cost me around ₹ 3740 approximately. And in fact, the virtual machine would sit idle for most of the time. So, despite costing more for continuously running containers, ACI can actually save a lot of money compare to virtual machines. This is very common when you are developing software to run small short-lived experiments. If you want to get a test instance of something running in the cloud, with ACI, you can quickly spin up a container, do your testing and then delete it when you are done. And here, you will have to only pay for a few hours of usage.
You can also use Azure Container Instances for batch jobs where you have a container image that has to process the jobs in your batch like media transcoding. Apart from all this, there are chances that your workload is sometimes highly variable. Probably the incoming traffic to a website might be extremely high or you might have to upload large amounts of data overnight. One way it is possible to scale your cluster up is by adding extra virtual machines. But the other way and the better one is to use ACI to elastically handle bursts of load without you needing to provide any type of extra hardware. You can say that Azure Container Instances might not be the right fit for every type of containerized workload but they can be the best option there is when you need to run short-lived containers to handle occasional workloads or high bursts of additional work.
Continuously Running Occasionally Running
Websites Continuous Integration
Databases Quick Experiments
Not cost-effective compared to virtual machines Load Testing and Batch Jobs
  Handle Spikes in Load/td>
Features of Azure Container Instances
  1. Azure Container Instances are easy to create using scripting languages such as Azure CLI. You can add and manage them using PowerShell, C# SDK, or ARM templates.
  2. You can configure networking features like assigning a public IP address, add a prefix for its domain name and you can also choose what ports to expose.
  3. Azure Container Instances can run either Windows or Linux containers.
  4. Linux containers are faster to start up because their image sizes are much smaller compared to Windows containers. Windows containers currently have a number of limitations and do not support all the exact same features that Linux containers do but hopefully, that will change soon.
  5. Azure Container Instances can have a restart policy allowing you to state that what should have happened when the container stopped.
  6. Azure Container Instances also allow you to mount volumes, where Azure file share is the most common use case. Other than that, you can also mount secret volumes or even git repositories as a volume.
  7. At the time of creating your container instance, you can optionally specify the command line just like you could it Docker where you can override the default initial command for a container.
  8. You can specify environment variables for your containers.
  9. Last but not least, you can also access the logs that the Azure Container Instances emit.