Microsoft.ContainerInstance/containerGroups template reference

API Version: 2017-10-01-preview

Template format

To create a Microsoft.ContainerInstance/containerGroups resource, add the following JSON to the resources section of your template.

{
  "name": "string",
  "type": "Microsoft.ContainerInstance/containerGroups",
  "apiVersion": "2017-10-01-preview",
  "location": "string",
  "tags": {},
  "properties": {
    "containers": [
      {
        "name": "string",
        "properties": {
          "image": "string",
          "command": [
            "string"
          ],
          "ports": [
            {
              "protocol": "string",
              "port": "integer"
            }
          ],
          "environmentVariables": [
            {
              "name": "string",
              "value": "string"
            }
          ],
          "resources": {
            "requests": {
              "memoryInGB": "number",
              "cpu": "number"
            },
            "limits": {
              "memoryInGB": "number",
              "cpu": "number"
            }
          },
          "volumeMounts": [
            {
              "name": "string",
              "mountPath": "string",
              "readOnly": boolean
            }
          ]
        }
      }
    ],
    "imageRegistryCredentials": [
      {
        "server": "string",
        "username": "string",
        "password": "string"
      }
    ],
    "restartPolicy": "string",
    "ipAddress": {
      "ports": [
        {
          "protocol": "string",
          "port": "integer"
        }
      ],
      "type": "Public",
      "ip": "string"
    },
    "osType": "string",
    "volumes": [
      {
        "name": "string",
        "azureFile": {
          "shareName": "string",
          "readOnly": boolean,
          "storageAccountName": "string",
          "storageAccountKey": "string"
        },
        "emptyDir": {}
      }
    ]
  }
}

Property values

The following tables describe the values you need to set in the schema.

Microsoft.ContainerInstance/containerGroups object

Name Type Required Value
name string Yes The name of the container group.
type enum Yes Microsoft.ContainerInstance/containerGroups
apiVersion enum Yes 2017-10-01-preview
location string Yes The resource location.
tags object No The resource tags.
properties object Yes ContainerGroup_properties object

ContainerGroup_properties object

Name Type Required Value
containers array No The containers within the container group. - Container object
imageRegistryCredentials array No The image registry credentials by which the container group is created from. - ImageRegistryCredential object
restartPolicy enum No Restart policy for all containers within the container group. - Always Always restart - OnFailure Restart on failure - Never Never restart. - Always, OnFailure, Never
ipAddress object No The IP address type of the container group. - IpAddress object
osType enum No The operating system type required by the containers in the container group. - Windows or Linux
volumes array No The list of volumes that can be mounted by containers in this container group. - Volume object

Container object

Name Type Required Value
name string Yes The user-provided name of the container instance.
properties object Yes The properties of the container instance. - ContainerProperties object

ImageRegistryCredential object

Name Type Required Value
server string Yes The Docker image registry server without a protocol such as "http" and "https".
username string Yes The username for the private registry.
password string No The password for the private registry.

IpAddress object

Name Type Required Value
ports array Yes The list of ports exposed on the container group. - Port object
type enum Yes Specifies if the IP is exposed to the public internet. - Public
ip string No The IP exposed to the public internet.

Volume object

Name Type Required Value
name string Yes The name of the volume.
azureFile object No The name of the Azure File volume. - AzureFileVolume object
emptyDir object No The empty directory volume.

ContainerProperties object

Name Type Required Value
image string Yes The name of the image used to create the container instance.
command array No The commands to execute within the container instance in exec form. - string
ports array No The exposed ports on the container instance. - ContainerPort object
environmentVariables array No The environment variables to set in the container instance. - EnvironmentVariable object
resources object Yes The resource requirements of the container instance. - ResourceRequirements object
volumeMounts array No The volume mounts available to the container instance. - VolumeMount object

Port object

Name Type Required Value
protocol enum No The protocol associated with the port. - TCP or UDP
port integer Yes The port number.

AzureFileVolume object

Name Type Required Value
shareName string Yes The name of the Azure File share to be mounted as a volume.
readOnly boolean No The flag indicating whether the Azure File shared mounted as a volume is read-only.
storageAccountName string Yes The name of the storage account that contains the Azure File share.
storageAccountKey string No The storage account access key used to access the Azure File share.

ContainerPort object

Name Type Required Value
protocol enum No The protocol associated with the port. - TCP or UDP
port integer Yes The port number exposed within the container group.

EnvironmentVariable object

Name Type Required Value
name string Yes The name of the environment variable.
value string Yes The value of the environment variable.

ResourceRequirements object

Name Type Required Value
requests object Yes The resource requests of this container instance. - ResourceRequests object
limits object No The resource limits of this container instance. - ResourceLimits object

VolumeMount object

Name Type Required Value
name string Yes The name of the volume mount.
mountPath string Yes The path within the container where the volume should be mounted. Must not contain colon (:).
readOnly boolean No The flag indicating whether the volume mount is read-only.

ResourceRequests object

Name Type Required Value
memoryInGB number Yes The memory request in GB of this container instance.
cpu number Yes The CPU request of this container instance.

ResourceLimits object

Name Type Required Value
memoryInGB number No The memory limit in GB of this container instance.
cpu number No The CPU limit of this container instance.

Quickstart templates

For example templates, see Container Instance templates.