az container

(PREVIEW) Manage Azure Container Instances.

Commands

az container create Create a container group.
az container delete Delete a container group.
az container list List container groups.
az container logs Examine the logs for a container group.
az container show Get the details of a container group.

az container create

Create a container group.

az container create --image
--name
--resource-group
[--command-line]
[--cpu]
[--environment-variables]
[--ip-address {Public}]
[--location]
[--memory]
[--os-type {Linux, Windows}]
[--port]
[--registry-login-server]
[--registry-password]
[--registry-username]

Examples

Create a container group with 1 core and 1Gb of memory.

az container create -g MyResourceGroup --name myalpine --image alpine:latest --cpu 1 --memory 1

Create a container group that runs Windows, with 2 cores and 3.5Gb of memory.

az container create -g MyResourceGroup --name mywinapp --image winappimage:latest --os-type Windows --cpu 2 --memory 3.5

Create a container group with public IP address.

az container create -g MyResourceGroup --name myalpine --image alpine:latest --ip-address public

Create a container group that invokes a script upon start.

az container create -g MyResourceGroup --name myalpine --image alpine:latest --command-line "/bin/sh -c '/path to/myscript.sh'"

Create a container group with environment variables.

az container create -g MyResourceGroup --name myalpine --image alpine:latest -e key1=value1 key2=value2

Create a container group using container image from Azure Container Registry.

az container create -g MyResourceGroup --name myalpine --image myAcrRegistry.azurecr.io/alpine:latest --registry-password password

Create a container group using container image from another private container image registry.

az container create -g MyResourceGroup --name myapp --image myimage:latest --cpu 1 --memory 1.5 --registry-login-server myregistry.com --registry-username username --registry-password password

Required Parameters

--image
The container image name.
--name -n
The name of the container group.
--resource-group -g
Name of resource group. You can configure the default group using `az configure --defaults group=<name>`.

Optional Parameters

--command-line
The command line to run when the container is started, e.g. '/bin/bash -c myscript.sh'.
--cpu
The required number of CPU cores of the containers.
default value: 1
--environment-variables -e
A list of environment variable for the container. Space separated values in 'key=value' format.
--ip-address
The IP address type of the container group.
accepted values: Public
--location -l
Location. You can configure the default location using `az configure --defaults location=<location>`.
--memory
The required memory of the containers in GB.
default value: 1.5
--os-type
The OS type of the containers.
accepted values: Linux, Windows
default value: Linux
--port
default value: 80
--registry-login-server
The container image registry login server.
--registry-password
The password to log in container image registry server.
--registry-username
The username to log in container image registry server.

az container delete

Delete a container group.

az container delete --name
--resource-group
[--yes]

Required Parameters

--name -n
The name of the container group.
--resource-group -g
Name of resource group. You can configure the default group using `az configure --defaults group=<name>`.

Optional Parameters

--yes -y
Do not prompt for confirmation.

az container list

List container groups.

az container list [--resource-group]

Optional Parameters

--resource-group -g
Name of resource group. You can configure the default group using `az configure --defaults group=<name>`.

az container logs

Examine the logs for a container group.

az container logs --name
--resource-group
[--container-name]

Required Parameters

--name -n
The name of the container group.
--resource-group -g
Name of resource group. You can configure the default group using `az configure --defaults group=<name>`.

Optional Parameters

--container-name
The container name to tail the logs.

az container show

Get the details of a container group.

az container show --name
--resource-group

Required Parameters

--name -n
The name of the container group.
--resource-group -g
Name of resource group. You can configure the default group using `az configure --defaults group=<name>`.