This article covers the syntax and properties for the YAML file supported by Azure Container Instances to configure a container group. Use a YAML file to input the group configuration to the az container create command in the Azure CLI.
A YAML file is a convenient way to configure a container group for reproducible deployments. It's a concise alternative to using a Resource Manager template or the Azure Container Instances SDKs to create or update a container group.
Note
This reference applies to YAML files for Azure Container Instances REST API version 2021-10-01.
Schema
The schema for the YAML file follows, including comments to highlight key properties. For a description of the properties in this schema, see the Property values section.
name: string # Name of the container group
apiVersion: '2021-10-01'
location: string
tags: {}
identity:
type: string
userAssignedIdentities: {}
properties: # Properties of container group
containers: # Array of container instances in the group
- name: string # Name of an instance
properties: # Properties of an instance
image: string # Container image used to create the instance
command:
- string
ports: # External-facing ports exposed on the instance, must also be set in group ipAddress property
- protocol: string
port: integer
environmentVariables:
- name: string
value: string
secureValue: string
resources: # Resource requirements of the instance
requests:
memoryInGB: number
cpu: number
gpu:
count: integer
sku: string
limits:
memoryInGB: number
cpu: number
gpu:
count: integer
sku: string
volumeMounts: # Array of volume mounts for the instance
- name: string
mountPath: string
readOnly: boolean
livenessProbe:
exec:
command:
- string
httpGet:
httpHeaders:
- name: string
value: string
path: string
port: integer
scheme: string
initialDelaySeconds: integer
periodSeconds: integer
failureThreshold: integer
successThreshold: integer
timeoutSeconds: integer
readinessProbe:
exec:
command:
- string
httpGet:
httpHeaders:
- name: string
value: string
path: string
port: integer
scheme: string
initialDelaySeconds: integer
periodSeconds: integer
failureThreshold: integer
successThreshold: integer
timeoutSeconds: integer
imageRegistryCredentials: # Credentials to pull a private image
- server: string
username: string
password: string
identity: string
identityUrl: string
restartPolicy: string
ipAddress: # IP address configuration of container group
ports:
- protocol: string
port: integer
type: string
ip: string
dnsNameLabel: string
dnsNameLabelReusePolicy: string
osType: string
volumes: # Array of volumes available to the instances
- name: string
azureFile:
shareName: string
readOnly: boolean
storageAccountName: string
storageAccountKey: string
emptyDir: {}
secret: {}
gitRepo:
directory: string
repository: string
revision: string
diagnostics:
logAnalytics:
workspaceId: string
workspaceKey: string
workspaceResourceId: string
logType: string
metadata: {}
subnetIds: # Subnet to deploy the container group into
- id: string
name: string
dnsConfig: # DNS configuration for container group
nameServers:
- string
searchDomains: string
options: string
sku: string # SKU for the container group
encryptionProperties:
vaultBaseUrl: string
keyName: string
keyVersion: string
initContainers: # Array of init containers in the group
- name: string
properties:
image: string
command:
- string
environmentVariables:
- name: string
value: string
secureValue: string
volumeMounts:
- name: string
mountPath: string
readOnly: boolean
Property values
The following tables describe the values you need to set in the schema.
The type of identity used for the container group. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' removes any identities from the container group. - SystemAssigned, UserAssigned, SystemAssigned, UserAssigned, None
userAssignedIdentities
object
No
The list of user identities associated with the container group. The user identity dictionary key references are Azure Resource Manager resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
Restart policy for all containers within the container group. - Always Always restart- OnFailure Restart on failure- Never Never restart. - Always, OnFailure, Never
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.
GitRepoVolume object
Name
Type
Required
Value
directory
string
No
Target directory name. Must not contain or start with '..'. If '.' is supplied, the volume directory is the git repository. Otherwise, if specified, the volume contains the git repository in the subdirectory with the given name.
repository
string
Yes
Repository URL
revision
string
No
Commit hash for the specified revision.
LogAnalytics object
Name
Type
Required
Value
workspaceId
string
Yes
The workspace ID for log analytics
workspaceKey
string
Yes
The workspace key for log analytics
workspaceResourceId
string
No
The workspace resource ID for log analytics
logType
enum
No
The log type to be used. - ContainerInsights or ContainerInstanceLogs
metadata
object
No
Metadata for log analytics.
InitContainerPropertiesDefinition object
Name
Type
Required
Value
image
string
No
The image of the init container.
command
array
No
The command to execute within the init container in exec form. - string
K80 and P100 GPU SKUs are retiring by August 31st, 2023. This is due to the retirement of the underlying VMs used: NC Series and NCv2 Series Although V100 SKUs will be available, it is receommended to use Azure Kubernetes Service instead. GPU resources are not fully supported and should not be used for production workloads. Use the following resources to migrate to AKS today: How to Migrate to AKS.