You may want to use containers for your deployments to Azure, but you may not want all the complexities of either standing up your own Kubernetes cluster on premises or Azure Kubernetes Service (AKS). For example, you may want to run a container for a short time.
Azure Container Instance have fast startup times, can be accessed using an IP address or a fully qualified domain name (FQDN). You can customize the size, use either Linux or Windows containers. You can schedule Linux containers to use NVIDIA Tesla GPU resources (preview).
Let’s learn more about Azure Container Instances.
The fastest and simplest way to run a container in Azure is to use Azure Container Instances. There is no need to provision any virtual machines or learning new tools. Run your Docker containers on-demand in a managed, serverless Azure environment.
The following illustration shows the steps in moving your Docker image to Azure Container Registry to Azure Container Instances.
Use Azure Container Instances for isolated containers without requiring orchestration. Good example are:
- Event-driven applications
- Deployment from your container development pipelines
- Run data processing and build jobs
- Facundo Gauna describes in a blog post, Load Testing with Azure Container Instances, how to use an Azure Container Instance to run a tests, then it stops as soon as the load test is complete.
With Azure Container Instances, you do not need to set up any container orchestrators or clusters nor have to do anything with virtual machines.
Container Instances in a virtual network
You can deploy your Azure Container Instances inside a virtual network. Use container instance in a virtual network when you need:
- Direct communication between container groups in the same subnet
- Send task-based workload output from container instances to a database in the virtual network
- Retrieve content for container instances from a service endpoint in the virtual network
- Enable container communication with on-premises resources through a VPN gateway or ExpressRoute
- Integrate with Azure Firewall to identify outbound traffic originating from the container
- Resolve names via the internal Azure DNS for communication with Azure resources in the virtual network, such as virtual machines
- Use network security group (NSG) rules to control container access to subnets or other network resources
However, there are unsupported scenarios. You cannot place an Azure Load Balancer in front of container instances, global virtual network peering is not supported, and container group deployed to a virtual network don’t currently support exposing containers directly to the internet with a public IP address or a fully qualified domain name.
There a sample template to deploy a container instance into an Azure virtual network available on GitHub.
Container Instances using the same host machine
A container group is a collection of containers that get scheduled on the same host machine. The containers in a container group share a lifecycle, resources, local network, and storage volumes. It’s similar in concept to a pod in Kubernetes. For more information, see Container groups in Azure Container Instances.
Multi-container groups are useful in dividing a single functional task into a small number of container images. These images can then be delivered by different teams and have separate resource requirements.
Example usage could include:
- A container serving a web application and a container pulling the latest content from source control.
- An application container and a logging container. The logging container collects the logs and metrics output by the main application and writes them to long-term storage.
- An application container and a monitoring container. The monitoring container periodically makes a request to the application to ensure that it’s running and responding correctly, and raises an alert if it’s not.
- A front-end container and a back-end container. The front end might serve a web application, with the back end running a service to retrieve data.
SFTP as a Container Instance
One interesting example is running SFTP on Azure. The application in GitHub provides for a Azure Container Instance that is connected to Azure Files, a fully managed SMB service. Once transfers are complete, manually stop the sftp-group to pause ACI’s billing. The files will remain accessible. You can manually start sftp-group and to copy more files at anytime.
Container Instances pricing
Azure Container Instances bill at the “container group” level which are assignments of vCPU/Memory resources that can be used by a single container or split by multiple containers. The price depends on the number of vCPU and GBs of memory allocated to the container group. For current rates, see Container Instance pricing.
Deploy to Azure Container Instances using the Docker CLI
Deploy to a container instance on-demand when you develop cloud-native apps and you want to switch seamlessly from local development to cloud deployment. You can use the Docker CLI.
Azure Container Instances documentation