Azure Container Instances let you run Docker containers in Azure without managing a full orchestration platform like Kubernetes. These are serverless containers that start quickly and are billed by the second, making them ideal for isolated workloads, testing, or applications that need to scale on demand. The service handles the underlying infrastructure, so you focus on the container itself rather than the virtual machines running it.
Resource Configuration
When you create a container instance, you must decide how much compute power it needs. CPU cores determine how many processing tasks the container can handle at once, while memory in gigabytes controls how much data the container can hold while running. You set these limits when you deploy, and Azure allocates the necessary resources from its infrastructure. If you allocate too little, the container may run slowly or fail; if you allocate too much, you pay for resources you do not use.
Networking and Access
Each container instance can be configured with a public or private IP address, which determines whether traffic from the internet can reach it. When you need the container to respond to users, you open a specific port and choose the protocol (usually TCP). The public IP makes the container reachable from anywhere, while a private IP restricts access to within your virtual network. This choice matters because public containers face the internet and need security measures, while private containers are safer but require other resources in the same network to reach them.
Security and Restart Behavior
You control what happens when a container stops by setting a restart policy. The Always policy keeps the container running and restarts it if it ever stops, which works for web services that must stay available. The OnFailure policy restarts the container only when it exits with an error, useful for batch jobs that should retry on failure. The Never policy leaves the container stopped after it finishes, which fits one-time tasks. Choosing the right policy prevents unnecessary restarts and ensures your application behaves as expected.