Container Groups - Create Or Update
Create or update container groups with specified configurations.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}?api-version=2018-04-01
Name | In | Required | Type | Description |
---|---|---|---|---|
container
|
path | True |
string |
The name of the container group. |
resource
|
path | True |
string |
The name of the resource group. |
subscription
|
path | True |
string |
Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. |
api-version
|
query | True |
string |
Client API version |
Name | Required | Type | Description |
---|---|---|---|
properties.containers | True |
The containers within the container group. |
|
properties.osType | True |
The operating system type required by the containers in the container group. |
|
location |
string |
The resource location. |
|
properties.imageRegistryCredentials |
The image registry credentials by which the container group is created from. |
||
properties.ipAddress |
The IP address type of the container group. |
||
properties.restartPolicy |
Restart policy for all containers within the container group.
|
||
properties.volumes |
Volume[] |
The list of volumes that can be mounted by containers in this container group. |
|
tags |
object |
The resource tags. |
Name | Type | Description |
---|---|---|
200 OK |
OK |
|
201 Created |
Created - the container group is created. |
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Name | Description |
---|---|
user_impersonation | Impersonate your user account |
Sample request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1?api-version=2018-04-01
{
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"location": "west us",
"name": "demo1",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5
}
},
"volumeMounts": [
{
"name": "volume1",
"mountPath": "/mnt/volume1",
"readOnly": false
},
{
"name": "volume2",
"mountPath": "/mnt/volume2",
"readOnly": false
},
{
"name": "volume3",
"mountPath": "/mnt/volume3",
"readOnly": true
}
]
}
}
],
"imageRegistryCredentials": [],
"ipAddress": {
"ports": [
{
"protocol": "TCP",
"port": 80
}
],
"type": "Public",
"dnsNameLabel": "dnsnamelabel1"
},
"osType": "Linux",
"volumes": [
{
"name": "volume1",
"azureFile": {
"shareName": "shareName",
"storageAccountName": "accountName",
"storageAccountKey": "accountKey"
}
},
{
"name": "volume2",
"emptyDir": {}
},
{
"name": "volume3",
"secret": {
"secretKey1": "SecretValue1InBase64",
"secretKey2": "SecretValue2InBase64"
}
}
]
},
"type": "Microsoft.ContainerInstance/containerGroups"
}
Sample response
{
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"location": "WestUs",
"name": "demo1",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5
}
},
"volumeMounts": [
{
"name": "volume1",
"mountPath": "/mnt/volume1",
"readOnly": false
},
{
"name": "volume2",
"mountPath": "/mnt/volume2",
"readOnly": false
},
{
"name": "volume3",
"mountPath": "/mnt/volume3",
"readOnly": true
}
]
}
}
],
"imageRegistryCredentials": [],
"ipAddress": {
"ip": "10.0.0.1",
"ports": [
{
"port": 80,
"protocol": "TCP"
}
],
"type": "Public",
"dnsNameLabel": "dnsnamelabel1",
"fqdn": "dnsnamelabel1.azure-container.io"
},
"osType": "Linux",
"provisioningState": "Succeeded",
"volumes": [
{
"name": "volume1",
"azureFile": {
"shareName": "shareName",
"storageAccountName": "accountName"
}
},
{
"name": "volume2",
"emptyDir": {}
},
{
"name": "volume3",
"secret": {}
}
]
},
"type": "Microsoft.ContainerInstance/containerGroups"
}
{
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1",
"location": "WestUs",
"name": "demo1",
"properties": {
"containers": [
{
"name": "demo1",
"properties": {
"command": [],
"environmentVariables": [],
"image": "nginx",
"ports": [
{
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5
}
},
"volumeMounts": [
{
"name": "volume1",
"mountPath": "/mnt/volume1",
"readOnly": false
},
{
"name": "volume2",
"mountPath": "/mnt/volume2",
"readOnly": false
},
{
"name": "volume3",
"mountPath": "/mnt/volume3",
"readOnly": true
}
]
}
}
],
"imageRegistryCredentials": [],
"ipAddress": {
"ip": "10.0.0.1",
"ports": [
{
"port": 80,
"protocol": "TCP"
}
],
"type": "Public",
"dnsNameLabel": "dnsnamelabel1",
"fqdn": "dnsnamelabel1.azure-container.io"
},
"osType": "Linux",
"provisioningState": "Succeeded",
"volumes": [
{
"name": "volume1",
"azureFile": {
"shareName": "shareName",
"storageAccountName": "accountName"
}
},
{
"name": "volume2",
"emptyDir": {}
},
{
"name": "volume3",
"secret": {}
}
]
},
"type": "Microsoft.ContainerInstance/containerGroups"
}
Name | Description |
---|---|
Azure |
The properties of the Azure File volume. Azure File shares are mounted as volumes. |
Container |
A container instance. |
Container |
A container group. |
Container |
Specifies if the IP is exposed to the public internet. |
Container |
The protocol associated with the port. |
Container |
Restart policy for all containers within the container group.
|
Container |
The protocol associated with the port. |
Container |
The port exposed on the container instance. |
Container |
The instance view of the container instance. Only valid in response. |
Container |
The container instance state. |
Empty |
The empty directory volume. |
Environment |
The environment variable to set within the container instance. |
Event |
A container group or container instance event. |
Git |
Represents a volume that is populated with the contents of a git repository |
Image |
Image registry credential. |
Instance |
The instance view of the container group. Only valid in response. |
Ip |
IP address for the container group. |
Operating |
The operating system type required by the containers in the container group. |
Port |
The port exposed on the container group. |
Resource |
The resource limits. |
Resource |
The resource requests. |
Resource |
The resource requirements. |
Volume |
The properties of the volume. |
Volume |
The properties of the volume mount. |
The properties of the Azure File volume. Azure File shares are mounted as volumes.
Name | Type | Description |
---|---|---|
readOnly |
boolean |
The flag indicating whether the Azure File shared mounted as a volume is read-only. |
shareName |
string |
The name of the Azure File share to be mounted as a volume. |
storageAccountKey |
string |
The storage account access key used to access the Azure File share. |
storageAccountName |
string |
The name of the storage account that contains the Azure File share. |
A container instance.
Name | Type | Description |
---|---|---|
name |
string |
The user-provided name of the container instance. |
properties.command |
string[] |
The commands to execute within the container instance in exec form. |
properties.environmentVariables |
The environment variables to set in the container instance. |
|
properties.image |
string |
The name of the image used to create the container instance. |
properties.instanceView |
The instance view of the container instance. Only valid in response. |
|
properties.ports |
The exposed ports on the container instance. |
|
properties.resources |
The resource requirements of the container instance. |
|
properties.volumeMounts |
The volume mounts available to the container instance. |
A container group.
Name | Type | Description |
---|---|---|
id |
string |
The resource id. |
location |
string |
The resource location. |
name |
string |
The resource name. |
properties.containers |
The containers within the container group. |
|
properties.imageRegistryCredentials |
The image registry credentials by which the container group is created from. |
|
properties.instanceView |
The instance view of the container group. Only valid in response. |
|
properties.ipAddress |
The IP address type of the container group. |
|
properties.osType |
The operating system type required by the containers in the container group. |
|
properties.provisioningState |
string |
The provisioning state of the container group. This only appears in the response. |
properties.restartPolicy |
Restart policy for all containers within the container group.
|
|
properties.volumes |
Volume[] |
The list of volumes that can be mounted by containers in this container group. |
tags |
object |
The resource tags. |
type |
string |
The resource type. |
Specifies if the IP is exposed to the public internet.
Value | Description |
---|---|
Public |
The protocol associated with the port.
Value | Description |
---|---|
TCP | |
UDP |
Restart policy for all containers within the container group.
Always
Always restartOnFailure
Restart on failureNever
Never restart
Value | Description |
---|---|
Always | |
Never | |
OnFailure |
The protocol associated with the port.
Value | Description |
---|---|
TCP | |
UDP |
The port exposed on the container instance.
Name | Type | Description |
---|---|---|
port |
integer |
The port number exposed within the container group. |
protocol |
The protocol associated with the port. |
The instance view of the container instance. Only valid in response.
Name | Type | Description |
---|---|---|
currentState |
Current container instance state. |
|
events |
Event[] |
The events of the container instance. |
previousState |
Previous container instance state. |
|
restartCount |
integer |
The number of times that the container instance has been restarted. |
The container instance state.
Name | Type | Description |
---|---|---|
detailStatus |
string |
The human-readable status of the container instance state. |
exitCode |
integer |
The container instance exit codes correspond to those from the |
finishTime |
string |
The date-time when the container instance state finished. |
startTime |
string |
The date-time when the container instance state started. |
state |
string |
The state of the container instance. |
The empty directory volume.
The environment variable to set within the container instance.
Name | Type | Description |
---|---|---|
name |
string |
The name of the environment variable. |
value |
string |
The value of the environment variable. |
A container group or container instance event.
Name | Type | Description |
---|---|---|
count |
integer |
The count of the event. |
firstTimestamp |
string |
The date-time of the earliest logged event. |
lastTimestamp |
string |
The date-time of the latest logged event. |
message |
string |
The event message. |
name |
string |
The event name. |
type |
string |
The event type. |
Represents a volume that is populated with the contents of a git repository
Name | Type | Description |
---|---|---|
directory |
string |
Target directory name. Must not contain or start with '..'. If '.' is supplied, the volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name. |
repository |
string |
Repository URL |
revision |
string |
Commit hash for the specified revision. |
Image registry credential.
Name | Type | Description |
---|---|---|
password |
string |
The password for the private registry. |
server |
string |
The Docker image registry server without a protocol such as "http" and "https". |
username |
string |
The username for the private registry. |
The instance view of the container group. Only valid in response.
Name | Type | Description |
---|---|---|
events |
Event[] |
The events of this container group. |
state |
string |
The state of the container group. Only valid in response. |
IP address for the container group.
Name | Type | Description |
---|---|---|
dnsNameLabel |
string |
The Dns name label for the IP. |
fqdn |
string |
The FQDN for the IP. |
ip |
string |
The IP exposed to the public internet. |
ports |
Port[] |
The list of ports exposed on the container group. |
type |
Specifies if the IP is exposed to the public internet. |
The operating system type required by the containers in the container group.
Value | Description |
---|---|
Linux | |
Windows |
The port exposed on the container group.
Name | Type | Description |
---|---|---|
port |
integer |
The port number. |
protocol |
The protocol associated with the port. |
The resource limits.
Name | Type | Description |
---|---|---|
cpu |
number |
The CPU limit of this container instance. |
memoryInGB |
number |
The memory limit in GB of this container instance. |
The resource requests.
Name | Type | Description |
---|---|---|
cpu |
number |
The CPU request of this container instance. |
memoryInGB |
number |
The memory request in GB of this container instance. |
The resource requirements.
Name | Type | Description |
---|---|---|
limits |
The resource limits of this container instance. |
|
requests |
The resource requests of this container instance. |
The properties of the volume.
Name | Type | Description |
---|---|---|
azureFile |
The Azure File volume. |
|
emptyDir |
The empty directory volume. |
|
gitRepo |
The git repo volume. |
|
name |
string |
The name of the volume. |
secret |
object |
The secret volume. |
The properties of the volume mount.
Name | Type | Description |
---|---|---|
mountPath |
string |
The path within the container where the volume should be mounted. Must not contain colon (:). |
name |
string |
The name of the volume mount. |
readOnly |
boolean |
The flag indicating whether the volume mount is read-only. |