LinuxCommandLibrary

az-container

Manage Azure Container Instances

TLDR

Create a container in a container group

$ az container create [[-g|--resource-group]] [resource_group] [[-n|--name]] [name] --image [image_name] [[-os|--os-type]] [windows|linux] --cpu [number_of_CPU_cores] --memory [memory_in_GB]
copy

Execute a command from within a running container of a container group
$ az container exec [[-g|--resource-group]] [resource_group] [[-n|--name]] [container_group_name] --exec-command "[command]"
copy

Examine the logs of a container in a container group
$ az container logs [[-n|--name]] [name] [[-g|--resource-group]] [resource_group]
copy

Get the details of a container group
$ az container show [[-n|--name]] [name] [[-g|--resource-group]] [resource_group]
copy

Start all containers in a container group
$ az container start [[-n|--name]] [name] [[-g|--resource-group]] [resource_group]
copy

Stop all containers in a container group
$ az container stop [[-n|--name]] [name] [[-g|--resource-group]] [resource_group]
copy

Delete a container group
$ az container delete [[-n|--name]] [name] [[-g|--resource-group]] [resource_group]
copy

SYNOPSIS

az container subcommand [options]

PARAMETERS

create
    Creates a new container group. This is the primary subcommand for deploying containers, requiring essential parameters like image name, resource group, and container group name. Additional options allow configuration of CPU, memory, ports, and networking.

show
    Retrieves the detailed configuration and status of a specific container group, identified by its name and resource group.

delete
    Deletes one or more container groups, releasing all associated resources and stopping running containers.

list
    Lists all container groups within a specified resource group or across an entire Azure subscription, providing an overview of deployments.

logs
    Fetches the logs for a specific container instance within a container group, enabling real-time monitoring and debugging.

exec
    Executes a command directly inside a running container instance, useful for interactive debugging or administrative tasks.

restart
    Restarts all containers within a specified container group, often used for applying configuration changes or resolving transient issues.

update
    Updates properties of an existing container group, such as environmental variables, without needing to recreate the entire group.

--help, -h
    Displays help information for the az container group or a specific subcommand, detailing available options and usage.

--output format, -o format
    Sets the output format for the command's result (e.g., json, table, tsv), useful for scripting and automation.

--query jmespath
    Applies a JMESPath query to filter and transform the output of a command, allowing users to extract specific data efficiently.

DESCRIPTION

The az container command, part of the Azure Command-Line Interface (CLI), provides a robust set of tools for managing Azure Container Instances (ACI) directly from your terminal. ACI allows developers to deploy Docker containers quickly and easily without the need to provision, manage, or scale underlying virtual machines. This command group is essential for serverless container workloads, simple applications, and task automation. Users can leverage az container to create new container groups, manage their lifecycle (start, stop, delete), monitor logs, and execute commands within running containers. It integrates seamlessly with other Azure services and offers a cost-effective, pay-per-second billing model. Its simplicity makes it an excellent choice for scenarios where full container orchestration, like Kubernetes, might be an overkill, providing instant deployment and scaling capabilities for individual containers or small container groups.

CAVEATS

Azure Container Instances (ACI) are primarily designed for stateless applications and burst workloads. While persistent storage can be mounted (e.g., Azure Files), it's not a full-fledged orchestration platform like Kubernetes and may not be suitable for complex microservice architectures requiring advanced service discovery or load balancing. Pricing is based on actual usage, so costs can accrue quickly if resources are over-provisioned or left running unnecessarily.

PRICING MODEL

ACI employs a pay-per-second billing model, where users are charged for the duration their container groups are running, based on allocated CPU and memory resources. This granular billing makes it cost-effective for intermittent workloads but requires careful resource allocation to avoid unexpected costs.

NETWORKING CAPABILITIES

Container groups can be deployed with a public IP address for internet accessibility or integrated into an Azure Virtual Network (VNet) for secure, private communication with other Azure resources and on-premises networks. This flexibility allows for diverse application architectures, from public-facing web apps to internal microservices.

HISTORY

Azure Container Instances (ACI) was introduced by Microsoft to address the need for a faster, simpler way to run containers in the cloud without managing underlying infrastructure. It aimed to bridge the gap between running containers locally and deploying them to full-scale orchestrators like Azure Kubernetes Service (AKS). Over time, az container and the ACI service have evolved to support various operating systems (Linux, Windows), GPU-enabled containers, and advanced networking features like VNET integration, continuously enhancing its utility for serverless container deployments and event-driven architectures.

SEE ALSO

az(1), docker(1), kubectl(1)

Copied to clipboard