Azure container instance provide the fastest and simplest way to run containers in Azure. Its a managed service provided by Azure, Its a serverless there for we don’t need to deploy and manage VMs for the container deployment.
Azure Container Instances use cases
- Continues integration build agents
- Short lived experiments – E.g – Try MongoDB, Perform load test
- Batch Jobs
- Elastic Scale for Kubernetes Cluster – virtual kubelet
Few characteristics of ACI
- Fast startup times
- Public IP connectivity and DNS name
- Hypervisor-level security
- Custom sizes
- Persistent storage
- Linux and Windows containers
- Co-scheduled groups
We can deploy ACI from Azure Portal, Azure CLI & Azure PowerShell. From this I’ll walkthrough deployment of ACI from Azure CLI.
Create Azure Resource Group for the deployment
# create a new resource group $resourceGroup = "ACISimpleApp" $location = "southeastasia" az group create -n $resourceGroup -l $location
Create an ACI from the docker image in docker hub
# create a docker container using the image from dockerhub $containerGroupName = "simpleapp" az container create -g $resourceGroup -n $containerGroupName ` --image kasunsjc/samplewebapp:v3` --ports 80 ` --ip-address public ` --dns-name-label samplewebapp1232
If the deployment is succeeded we can access the application from the FQDN
In overview of the ACI we can see the FQDN, status & OS type the container running.
In Settings –> Container we can see the events related to ACI. If we want to connect to this container through CLI we can initiate a shell session from the portal it self.
Another good feature we can use, is access the logs of the container we can print out the logs to CLI from below command
# view the logs az container logs -n $containerGroupName -g $resourceGroup
After try out we can clean up the deployment by deleting the Resource Group.
# clean up az group delete -n $resourceGroup -y