LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

az-container

Manage Azure Container Instances

TLDR

Create a container instance
$ az container create -g [resource-group] --name [container-name] --image [image:tag] --cpu [1] --memory [1]
copy
Create with public IP and DNS name
$ az container create -g [resource-group] --name [container-name] --image [image:tag] --ports [80] --dns-name-label [myapp]
copy
List container groups in a resource group
$ az container list -g [resource-group]
copy
View container logs
$ az container logs -g [resource-group] --name [container-name]
copy
Execute a command in a running container
$ az container exec -g [resource-group] --name [container-name] --exec-command "[/bin/bash]"
copy
Show container details
$ az container show -g [resource-group] --name [container-name]
copy
Stop a container group
$ az container stop -g [resource-group] --name [container-name]
copy
Delete a container group
$ az container delete -g [resource-group] --name [container-name]
copy

SYNOPSIS

az container subcommand [options]

DESCRIPTION

az container manages Azure Container Instances (ACI), providing the fastest way to run containers in Azure without managing virtual machines or adopting orchestration services.ACI is ideal for isolated containers, simple applications, task automation, and build jobs. For scenarios requiring full container orchestration, use Azure Kubernetes Service (AKS).

PARAMETERS

-g, --resource-group value

Name of the resource group
--name value
Name of the container group
--image value
Container image (e.g., nginx:latest)
--cpu value
Number of CPU cores (default: 1)
--memory value
Memory in GB (default: 1.5)
--ports value
Space-separated list of ports to open
--dns-name-label value
DNS name label for the public IP
--os-type value
Operating system type: Linux or Windows (default: Linux)
--ip-address value
IP address type: Public or Private
--restart-policy value
Restart policy: Always, OnFailure, or Never (default: Always)
-e, --environment-variables key=value
Environment variables (space-separated key=value pairs)
--secure-environment-variables key=value
Secure environment variables (not shown in logs or portal)
--registry-login-server value
Private container registry login server

SUBCOMMANDS

Lifecycle

create, delete, start, stop, restart
Information
show, list, logs
Interaction
attach, exec, export
Profiles
container-group-profile create, container-group-profile delete, container-group-profile list

CAVEATS

Container groups with public IPs are charged even when stopped; delete to avoid charges. Windows containers have limited image support and higher resource requirements. Environment variables containing secrets should use secure values. Maximum resource limits apply per region and subscription.

HISTORY

Azure Container Instances launched in July 2017 as the first serverless container service on any public cloud. It enabled running containers without managing infrastructure, bridging the gap between VMs and full orchestration platforms.

SEE ALSO

az(1), az-aks(1), docker(1)

Copied to clipboard
Kai