Container Groups - Create Or Update

创建或更新具有指定配置的容器组。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}?api-version=2023-05-01

URI 参数

名称 必需 类型 说明
containerGroupName
path True

string

容器组的名称。

resourceGroupName
path True

string

资源组的名称。

subscriptionId
path True

string

唯一标识 azure 订阅Microsoft的订阅凭据。 订阅 ID 构成了每个服务调用的 URI 的一部分。

api-version
query True

string

客户端 API 版本

请求正文

名称 必需 类型 说明
properties.containers True

Container[]

容器组中的容器。

properties.osType True

OperatingSystemTypes

容器组中容器所需的操作系统类型。

identity

ContainerGroupIdentity

容器组的标识(如果已配置)。

___location

string

资源位置。

properties.confidentialComputeProperties

ConfidentialComputeProperties

机密容器组的属性

properties.diagnostics

ContainerGroupDiagnostics

容器组的诊断信息。

properties.dnsConfig

DnsConfiguration

容器组的 DNS 配置信息。

properties.encryptionProperties

EncryptionProperties

容器组的加密属性。

properties.extensions

DeploymentExtensionSpec[]

虚拟 kubelet 使用的扩展

properties.imageRegistryCredentials

ImageRegistryCredential[]

从中创建容器组的映像注册表凭据。

properties.initContainers

InitContainerDefinition[]

容器组的初始化容器。

properties.ipAddress

IpAddress

容器组的 IP 地址类型。

properties.priority

ContainerGroupPriority

容器组的优先级。

properties.restartPolicy

ContainerGroupRestartPolicy

重启容器组中所有容器的策略。

  • Always 始终重启
  • 失败时 OnFailure 重启
  • Never 从不重启
properties.sku

ContainerGroupSku

容器组的 SKU。

properties.subnetIds

ContainerGroupSubnetId[]

容器组的子网资源 ID。

properties.volumes

Volume[]

此容器组中的容器可以装载的卷列表。

tags

object

资源标记。

zones

string[]

容器组的区域。

响应

名称 类型 说明
200 OK

ContainerGroup

还行

201 Created

ContainerGroup

创建 - 创建容器组。

Other Status Codes

CloudError

描述作失败的原因的错误响应。

安全性

azure_auth

Azure Active Directory OAuth2 Flow

类型: oauth2
流向: implicit
授权 URL: https://login.microsoftonline.com/common/oauth2/authorize

作用域

名称 说明
user_impersonation 模拟用户帐户

示例

ConfidentialContainerGroup
ContainerGroupCreateWithExtensions
ContainerGroupsCreateOrUpdate
ContainerGroupsCreateWithPriority
ContainerGroupWithEncryptionProperties

ConfidentialContainerGroup

示例请求

PUT https://management.azure.com/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1?api-version=2023-05-01

{
  "___location": "westeurope",
  "properties": {
    "containers": [
      {
        "name": "accdemo",
        "properties": {
          "command": [],
          "environmentVariables": [],
          "image": "confiimage",
          "ports": [
            {
              "port": 8000
            }
          ],
          "resources": {
            "requests": {
              "cpu": 1,
              "memoryInGB": 1.5
            }
          },
          "securityContext": {
            "privileged": false,
            "capabilities": {
              "add": [
                "CAP_NET_ADMIN"
              ]
            }
          }
        }
      }
    ],
    "imageRegistryCredentials": [],
    "ipAddress": {
      "ports": [
        {
          "protocol": "TCP",
          "port": 8000
        }
      ],
      "type": "Public"
    },
    "osType": "Linux",
    "sku": "Confidential",
    "confidentialComputeProperties": {
      "ccePolicy": "eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19"
    }
  }
}

示例响应

{
  "properties": {
    "sku": "Confidential",
    "provisioningState": "Succeeded",
    "containers": [
      {
        "name": "accdemo",
        "properties": {
          "image": "confiimage",
          "command": [],
          "ports": [
            {
              "port": 8000
            }
          ],
          "environmentVariables": [],
          "resources": {
            "requests": {
              "memoryInGB": 1.5,
              "cpu": 1
            }
          },
          "securityContext": {
            "privileged": false,
            "capabilities": {
              "add": [
                "CAP_NET_ADMIN"
              ]
            }
          }
        }
      }
    ],
    "ipAddress": {
      "ports": [
        {
          "protocol": "TCP",
          "port": 8000
        }
      ],
      "type": "Public"
    },
    "initContainers": [],
    "imageRegistryCredentials": [],
    "osType": "Linux",
    "instanceView": {
      "events": [],
      "state": "Running"
    },
    "confidentialComputeProperties": {
      "ccePolicy": "eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19"
    }
  },
  "id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1",
  "name": "demo1",
  "type": "Microsoft.ContainerInstance/containerGroups",
  "___location": "westeurope"
}
{
  "properties": {
    "sku": "Confidential",
    "provisioningState": "Succeeded",
    "containers": [
      {
        "name": "accdemo",
        "properties": {
          "image": "confiimage",
          "command": [],
          "ports": [
            {
              "port": 8000
            }
          ],
          "environmentVariables": [],
          "resources": {
            "requests": {
              "memoryInGB": 1.5,
              "cpu": 1
            }
          },
          "securityContext": {
            "privileged": false,
            "capabilities": {
              "add": [
                "CAP_NET_ADMIN"
              ]
            }
          }
        }
      }
    ],
    "ipAddress": {
      "ports": [
        {
          "protocol": "TCP",
          "port": 8000
        }
      ],
      "type": "Public"
    },
    "initContainers": [],
    "imageRegistryCredentials": [],
    "osType": "Linux",
    "instanceView": {
      "events": [],
      "state": "Running"
    },
    "confidentialComputeProperties": {
      "ccePolicy": "eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19"
    }
  },
  "id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1",
  "name": "demo1",
  "type": "Microsoft.ContainerInstance/containerGroups",
  "___location": "westeurope"
}

ContainerGroupCreateWithExtensions

示例请求

PUT https://management.azure.com/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1?api-version=2023-05-01

{
  "___location": "eastus2",
  "properties": {
    "containers": [
      {
        "name": "demo1",
        "properties": {
          "command": [],
          "environmentVariables": [],
          "image": "nginx",
          "ports": [
            {
              "port": 80
            }
          ],
          "resources": {
            "requests": {
              "cpu": 1,
              "memoryInGB": 1.5
            }
          }
        }
      }
    ],
    "imageRegistryCredentials": [],
    "ipAddress": {
      "ports": [
        {
          "protocol": "TCP",
          "port": 80
        }
      ],
      "type": "Private"
    },
    "osType": "Linux",
    "subnetIds": [
      {
        "id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-rg-vnet/subnets/test-subnet"
      }
    ],
    "extensions": [
      {
        "name": "kube-proxy",
        "properties": {
          "extensionType": "kube-proxy",
          "version": "1.0",
          "settings": {
            "clusterCidr": "10.240.0.0/16",
            "kubeVersion": "v1.9.10"
          },
          "protectedSettings": {
            "kubeConfig": "<kubeconfig encoded string>"
          }
        }
      },
      {
        "name": "vk-realtime-metrics",
        "properties": {
          "extensionType": "realtime-metrics",
          "version": "1.0"
        }
      }
    ]
  }
}

示例响应

{
  "properties": {
    "sku": "Standard",
    "provisioningState": "Pending",
    "containers": [
      {
        "name": "demo1",
        "properties": {
          "image": "nginx",
          "command": [],
          "ports": [
            {
              "port": 80
            }
          ],
          "environmentVariables": [],
          "resources": {
            "requests": {
              "memoryInGB": 1.5,
              "cpu": 1
            }
          }
        }
      }
    ],
    "initContainers": [],
    "extensions": [
      {
        "name": "kube-proxy",
        "properties": {
          "extensionType": "kube-proxy",
          "version": "1.0",
          "settings": {
            "clusterCidr": "10.240.0.0/16",
            "kubeVersion": "v1.9.10"
          }
        }
      },
      {
        "name": "vk-realtime-metrics",
        "properties": {
          "extensionType": "realtime-metrics",
          "version": "1.0"
        }
      }
    ],
    "imageRegistryCredentials": [],
    "osType": "Linux",
    "instanceView": {
      "events": [],
      "state": "Pending"
    },
    "subnetIds": [
      {
        "id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-rg-vnet/subnets/test-subnet"
      }
    ]
  },
  "id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1",
  "name": "demo1",
  "type": "Microsoft.ContainerInstance/containerGroups",
  "___location": "eastus2"
}
{
  "properties": {
    "sku": "Standard",
    "provisioningState": "Pending",
    "containers": [
      {
        "name": "demo1",
        "properties": {
          "image": "nginx",
          "command": [],
          "ports": [
            {
              "port": 80
            }
          ],
          "environmentVariables": [],
          "resources": {
            "requests": {
              "memoryInGB": 1.5,
              "cpu": 1
            }
          }
        }
      }
    ],
    "initContainers": [],
    "extensions": [
      {
        "name": "kube-proxy",
        "properties": {
          "extensionType": "kube-proxy",
          "version": "1.0",
          "settings": {
            "clusterCidr": "10.240.0.0/16",
            "kubeVersion": "v1.9.10"
          }
        }
      },
      {
        "name": "vk-realtime-metrics",
        "properties": {
          "extensionType": "realtime-metrics",
          "version": "1.0"
        }
      }
    ],
    "imageRegistryCredentials": [],
    "osType": "Linux",
    "instanceView": {
      "events": [],
      "state": "Running"
    },
    "subnetIds": [
      {
        "id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-rg-vnet/subnets/test-subnet"
      }
    ]
  },
  "id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1",
  "name": "demo1",
  "type": "Microsoft.ContainerInstance/containerGroups",
  "___location": "eastus2"
}

ContainerGroupsCreateOrUpdate

示例请求

PUT https://management.azure.com/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1?api-version=2023-05-01

{
  "___location": "west us",
  "identity": {
    "type": "SystemAssigned, UserAssigned",
    "userAssignedIdentities": {
      "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name": {}
    }
  },
  "properties": {
    "containers": [
      {
        "name": "demo1",
        "properties": {
          "command": [],
          "environmentVariables": [],
          "image": "nginx",
          "ports": [
            {
              "port": 80
            }
          ],
          "resources": {
            "requests": {
              "cpu": 1,
              "memoryInGB": 1.5,
              "gpu": {
                "count": 1,
                "sku": "K80"
              }
            }
          },
          "volumeMounts": [
            {
              "name": "volume1",
              "mountPath": "/mnt/volume1",
              "readOnly": false
            },
            {
              "name": "volume2",
              "mountPath": "/mnt/volume2",
              "readOnly": false
            },
            {
              "name": "volume3",
              "mountPath": "/mnt/volume3",
              "readOnly": true
            }
          ]
        }
      }
    ],
    "diagnostics": {
      "logAnalytics": {
        "workspaceId": "workspaceid",
        "workspaceKey": "workspaceKey",
        "logType": "ContainerInsights",
        "metadata": {
          "test-key": "test-metadata-value"
        },
        "workspaceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace"
      }
    },
    "subnetIds": [
      {
        "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]"
      }
    ],
    "dnsConfig": {
      "nameServers": [
        "1.1.1.1"
      ],
      "searchDomains": "cluster.local svc.cluster.local",
      "options": "ndots:2"
    },
    "imageRegistryCredentials": [],
    "ipAddress": {
      "ports": [
        {
          "protocol": "TCP",
          "port": 80
        }
      ],
      "type": "Public",
      "dnsNameLabel": "dnsnamelabel1",
      "autoGeneratedDomainNameLabelScope": "Unsecure"
    },
    "osType": "Linux",
    "volumes": [
      {
        "name": "volume1",
        "azureFile": {
          "shareName": "shareName",
          "storageAccountName": "accountName",
          "storageAccountKey": "accountKey"
        }
      },
      {
        "name": "volume2",
        "emptyDir": {}
      },
      {
        "name": "volume3",
        "secret": {
          "secretKey1": "SecretValue1InBase64",
          "secretKey2": "SecretValue2InBase64"
        }
      }
    ]
  }
}

示例响应

{
  "id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1",
  "___location": "WestUs",
  "zones": [
    "1"
  ],
  "name": "demo1",
  "properties": {
    "containers": [
      {
        "name": "demo1",
        "properties": {
          "command": [],
          "environmentVariables": [],
          "image": "nginx",
          "ports": [
            {
              "port": 80
            }
          ],
          "resources": {
            "requests": {
              "cpu": 1,
              "memoryInGB": 1.5,
              "gpu": {
                "count": 1,
                "sku": "K80"
              }
            }
          },
          "volumeMounts": [
            {
              "name": "volume1",
              "mountPath": "/mnt/volume1",
              "readOnly": false
            },
            {
              "name": "volume2",
              "mountPath": "/mnt/volume2",
              "readOnly": false
            },
            {
              "name": "volume3",
              "mountPath": "/mnt/volume3",
              "readOnly": true
            }
          ]
        }
      }
    ],
    "diagnostics": {
      "logAnalytics": {
        "workspaceId": "workspaceid"
      }
    },
    "dnsConfig": {
      "nameServers": [
        "1.1.1.1"
      ],
      "searchDomains": "cluster.local svc.cluster.local",
      "options": "ndots:2"
    },
    "imageRegistryCredentials": [],
    "ipAddress": {
      "ip": "10.0.0.1",
      "ports": [
        {
          "port": 80,
          "protocol": "TCP"
        }
      ],
      "type": "Public",
      "dnsNameLabel": "dnsnamelabel1",
      "autoGeneratedDomainNameLabelScope": "Unsecure",
      "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",
  "zones": [
    "1"
  ],
  "name": "demo1",
  "properties": {
    "containers": [
      {
        "name": "demo1",
        "properties": {
          "command": [],
          "environmentVariables": [],
          "image": "nginx",
          "ports": [
            {
              "port": 80
            }
          ],
          "resources": {
            "requests": {
              "cpu": 1,
              "memoryInGB": 1.5,
              "gpu": {
                "count": 1,
                "sku": "K80"
              }
            }
          },
          "volumeMounts": [
            {
              "name": "volume1",
              "mountPath": "/mnt/volume1",
              "readOnly": false
            },
            {
              "name": "volume2",
              "mountPath": "/mnt/volume2",
              "readOnly": false
            },
            {
              "name": "volume3",
              "mountPath": "/mnt/volume3",
              "readOnly": true
            }
          ]
        }
      }
    ],
    "dnsConfig": {
      "nameServers": [
        "1.1.1.1"
      ]
    },
    "imageRegistryCredentials": [],
    "ipAddress": {
      "ip": "10.0.0.1",
      "ports": [
        {
          "port": 80,
          "protocol": "TCP"
        }
      ],
      "type": "Public",
      "dnsNameLabel": "dnsnamelabel1",
      "autoGeneratedDomainNameLabelScope": "Unsecure",
      "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"
}

ContainerGroupsCreateWithPriority

示例请求

PUT https://management.azure.com/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1?api-version=2023-05-01

{
  "properties": {
    "sku": "Standard",
    "containers": [
      {
        "name": "test-container-001",
        "properties": {
          "image": "alpine:latest",
          "command": [
            "/bin/sh",
            "-c",
            "sleep 10"
          ],
          "resources": {
            "requests": {
              "memoryInGB": 1,
              "cpu": 1
            }
          }
        }
      }
    ],
    "restartPolicy": "Never",
    "osType": "Linux",
    "priority": "Spot"
  },
  "___location": "eastus"
}

示例响应

{
  "properties": {
    "sku": "Standard",
    "provisioningState": "Succeeded",
    "containers": [
      {
        "name": "test-container-001",
        "properties": {
          "image": "alpine:latest",
          "command": [
            "/bin/sh",
            "-c",
            "sleep 10"
          ],
          "ports": [],
          "environmentVariables": [],
          "resources": {
            "requests": {
              "memoryInGB": 1,
              "cpu": 1
            }
          }
        }
      }
    ],
    "initContainers": [],
    "restartPolicy": "Never",
    "osType": "Linux",
    "instanceView": {
      "events": [],
      "state": "Succeeded"
    },
    "priority": "Spot"
  },
  "id": "/subscriptions/subId/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1",
  "name": "demo1",
  "type": "Microsoft.ContainerInstance/containerGroups",
  "___location": "eastus"
}
{
  "properties": {
    "sku": "Standard",
    "provisioningState": "Created",
    "containers": [
      {
        "name": "test-container-001",
        "properties": {
          "image": "alpine:latest",
          "command": [
            "/bin/sh",
            "-c",
            "sleep 10"
          ],
          "ports": [],
          "environmentVariables": [],
          "resources": {
            "requests": {
              "memoryInGB": 1,
              "cpu": 1
            }
          }
        }
      }
    ],
    "initContainers": [],
    "restartPolicy": "Never",
    "osType": "Linux",
    "instanceView": {
      "events": [],
      "state": "Created"
    },
    "priority": "Spot"
  },
  "id": "/subscriptions/subId/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1",
  "name": "demo1",
  "type": "Microsoft.ContainerInstance/containerGroups",
  "___location": "eastus"
}

ContainerGroupWithEncryptionProperties

示例请求

PUT https://management.azure.com/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1?api-version=2023-05-01

{
  "___location": "eastus2",
  "identity": {
    "type": "UserAssigned",
    "userAssignedIdentities": {
      "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity": {}
    }
  },
  "properties": {
    "containers": [
      {
        "name": "demo1",
        "properties": {
          "command": [],
          "environmentVariables": [],
          "image": "nginx",
          "ports": [
            {
              "port": 80
            }
          ],
          "resources": {
            "requests": {
              "cpu": 1,
              "memoryInGB": 1.5
            }
          }
        }
      }
    ],
    "imageRegistryCredentials": [],
    "ipAddress": {
      "ports": [
        {
          "protocol": "TCP",
          "port": 80
        }
      ],
      "type": "Public"
    },
    "osType": "Linux",
    "encryptionProperties": {
      "vaultBaseUrl": "https://testkeyvault.vault.azure.net",
      "keyName": "test-key",
      "keyVersion": "<key version>",
      "identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity"
    }
  }
}

示例响应

{
  "properties": {
    "sku": "Standard",
    "encryptionProperties": {
      "vaultBaseUrl": "https://testkeyvault.vault.azure.net/",
      "keyName": "test-key",
      "keyVersion": "<key version>",
      "identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity"
    },
    "provisioningState": "Pending",
    "containers": [
      {
        "name": "demo1",
        "properties": {
          "image": "nginx",
          "command": [],
          "ports": [
            {
              "port": 80
            }
          ],
          "environmentVariables": [],
          "resources": {
            "requests": {
              "memoryInGB": 1.5,
              "cpu": 1
            }
          }
        }
      }
    ],
    "initContainers": [],
    "imageRegistryCredentials": [],
    "ipAddress": {
      "ports": [
        {
          "protocol": "TCP",
          "port": 80
        }
      ],
      "type": "Public"
    },
    "osType": "Linux",
    "instanceView": {
      "events": [],
      "state": "Pending"
    }
  },
  "identity": {
    "userAssignedIdentities": {
      "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity": {
        "principalId": "<principal id>",
        "clientId": "<client id>"
      }
    },
    "tenantId": "<tenant id>",
    "type": "UserAssigned"
  },
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1",
  "name": "demo1",
  "type": "Microsoft.ContainerInstance/containerGroups",
  "___location": "eastus2"
}
{
  "properties": {
    "sku": "Standard",
    "encryptionProperties": {
      "vaultBaseUrl": "https://testkeyvault.vault.azure.net/",
      "keyName": "test-key",
      "keyVersion": "key version",
      "identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity"
    },
    "provisioningState": "Running",
    "containers": [
      {
        "name": "demo1",
        "properties": {
          "image": "nginx",
          "command": [],
          "ports": [
            {
              "port": 80
            }
          ],
          "environmentVariables": [],
          "resources": {
            "requests": {
              "memoryInGB": 1.5,
              "cpu": 1
            }
          }
        }
      }
    ],
    "initContainers": [],
    "imageRegistryCredentials": [],
    "ipAddress": {
      "ports": [
        {
          "protocol": "TCP",
          "port": 80
        }
      ],
      "type": "Public"
    },
    "osType": "Linux",
    "instanceView": {
      "events": [],
      "state": "Pending"
    }
  },
  "identity": {
    "userAssignedIdentities": {
      "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity": {
        "principalId": "<principal id>",
        "clientId": "<client id>"
      }
    },
    "tenantId": "<tenant id>",
    "type": "UserAssigned"
  },
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ContainerInstance/containerGroups/demo1",
  "name": "demo1",
  "type": "Microsoft.ContainerInstance/containerGroups",
  "___location": "eastus2"
}

定义

名称 说明
AzureFileVolume

Azure 文件卷的属性。 Azure 文件共享装载为卷。

CloudError

容器实例服务的错误响应。

CloudErrorBody

容器实例服务的错误响应。

ConfidentialComputeProperties

机密容器组的属性

Container

容器实例。

ContainerExec

容器执行命令,用于实时或就绪情况探测

ContainerGroup

容器组。

ContainerGroupDiagnostics

容器组诊断信息。

ContainerGroupIdentity

容器组的标识。

ContainerGroupIpAddressType

指定 IP 是否向公共 Internet 或专用 VNET 公开。

ContainerGroupNetworkProtocol

与端口关联的协议。

ContainerGroupPriority

容器组的优先级。

ContainerGroupProperties.properties.InstanceView

容器组的实例视图。 仅在响应中有效。

ContainerGroupRestartPolicy

重启容器组中所有容器的策略。

  • Always 始终重启
  • 失败时 OnFailure 重启
  • Never 从不重启
ContainerGroupSku

容器组 SKU。

ContainerGroupSubnetId

容器组子网信息。

ContainerHttpGet

容器 Http Get 设置,用于实时或就绪情况探测

ContainerNetworkProtocol

与端口关联的协议。

ContainerPort

在容器实例上公开的端口。

ContainerProbe

容器探测,用于生存或就绪情况

ContainerState

容器实例状态。

DeploymentExtensionSpec

要添加到部署中的扩展 sidecar。

DnsConfiguration

容器组的 DNS 配置。

dnsNameLabelReusePolicy

表示安全枚举的值。 如果未选择“不安全”值,则为默认值,表示对象域名标签不受子域接管保护。 如果选中“TenantReuse”值,则为默认值,表示可以在同一租户中重复使用对象的域名标签。 “SubscriptionReuse”值表示可以在同一订阅中重复使用对象的域名标签。 “ResourceGroupReuse”值表示可以在同一资源组中重复使用对象的域名标签。 “NoReuse”值表示不能在同一资源组、订阅或租户中重复使用对象的域名标签。

EmptyDirVolume

空目录卷。

EncryptionProperties

容器组加密属性。

EnvironmentVariable

在容器实例中设置的环境变量。

Event

容器组或容器实例事件。

GitRepoVolume

表示使用 git 存储库的内容填充的卷

GpuResource

GPU 资源。

GpuSku

GPU 资源的 SKU。

HttpHeader

HTTP 标头。

ImageRegistryCredential

映像注册表凭据。

InitContainerDefinition

init 容器定义。

InitContainerPropertiesDefinition.InstanceView

init 容器的实例视图。 仅在响应中有效。

InstanceView

容器实例的实例视图。 仅在响应中有效。

IpAddress

容器组的 IP 地址。

LogAnalytics

容器组日志分析信息。

LogAnalyticsLogType

要使用的日志类型。

OperatingSystemTypes

容器组中容器所需的操作系统类型。

Port

容器组上公开的端口。

ResourceIdentityType

用于容器组的标识类型。 类型“SystemAssigned,UserAssigned”包括隐式创建的标识和一组用户分配的标识。 类型“None”将从容器组中删除任何标识。

ResourceLimits

资源限制。

ResourceRequests

资源请求。

ResourceRequirements

资源要求。

Scheme

方案。

SecurityContextCapabilitiesDefinition

从容器添加或删除的功能。

SecurityContextDefinition

容器的安全上下文。

UserAssignedIdentities

与容器组关联的用户标识列表。 用户标识字典密钥引用的格式为 ARM 资源 ID:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}”。

Volume

卷的属性。

VolumeMount

卷装载的属性。

AzureFileVolume

Azure 文件卷的属性。 Azure 文件共享装载为卷。

名称 类型 说明
readOnly

boolean

指示装载为卷的 Azure 文件共享是否为只读的标志。

shareName

string

要装载为卷的 Azure 文件共享的名称。

storageAccountKey

string

用于访问 Azure 文件共享的存储帐户访问密钥。

storageAccountName

string

包含 Azure 文件共享的存储帐户的名称。

CloudError

容器实例服务的错误响应。

名称 类型 说明
error

CloudErrorBody

容器实例服务的错误响应。

CloudErrorBody

容器实例服务的错误响应。

名称 类型 说明
code

string

错误的标识符。 代码是固定的,旨在以编程方式使用。

details

CloudErrorBody[]

有关错误的其他详细信息的列表。

message

string

描述错误的消息,旨在适合在用户界面中显示。

target

string

特定错误的目标。 例如,错误属性的名称。

ConfidentialComputeProperties

机密容器组的属性

名称 类型 说明
ccePolicy

string

base64 编码的机密计算强制策略

Container

容器实例。

名称 类型 说明
name

string

容器实例的用户提供的名称。

properties.command

string[]

要以 exec 形式在容器实例中执行的命令。

properties.environmentVariables

EnvironmentVariable[]

在容器实例中设置的环境变量。

properties.image

string

用于创建容器实例的映像的名称。

properties.instanceView

InstanceView

容器实例的实例视图。 仅在响应中有效。

properties.livenessProbe

ContainerProbe

生存度探测。

properties.ports

ContainerPort[]

容器实例上公开的端口。

properties.readinessProbe

ContainerProbe

就绪情况探测。

properties.resources

ResourceRequirements

容器实例的资源要求。

properties.securityContext

SecurityContextDefinition

容器安全属性。

properties.volumeMounts

VolumeMount[]

卷装载可用于容器实例。

ContainerExec

容器执行命令,用于实时或就绪情况探测

名称 类型 说明
command

string[]

在容器中执行的命令。

ContainerGroup

容器组。

名称 类型 说明
id

string

资源 ID。

identity

ContainerGroupIdentity

容器组的标识(如果已配置)。

___location

string

资源位置。

name

string

资源名称。

properties.confidentialComputeProperties

ConfidentialComputeProperties

机密容器组的属性

properties.containers

Container[]

容器组中的容器。

properties.diagnostics

ContainerGroupDiagnostics

容器组的诊断信息。

properties.dnsConfig

DnsConfiguration

容器组的 DNS 配置信息。

properties.encryptionProperties

EncryptionProperties

容器组的加密属性。

properties.extensions

DeploymentExtensionSpec[]

虚拟 kubelet 使用的扩展

properties.imageRegistryCredentials

ImageRegistryCredential[]

从中创建容器组的映像注册表凭据。

properties.initContainers

InitContainerDefinition[]

容器组的初始化容器。

properties.instanceView

ContainerGroupProperties.properties.InstanceView

容器组的实例视图。 仅在响应中有效。

properties.ipAddress

IpAddress

容器组的 IP 地址类型。

properties.osType

OperatingSystemTypes

容器组中容器所需的操作系统类型。

properties.priority

ContainerGroupPriority

容器组的优先级。

properties.provisioningState

string

容器组的预配状态。 这仅在响应中显示。

properties.restartPolicy

ContainerGroupRestartPolicy

重启容器组中所有容器的策略。

  • Always 始终重启
  • 失败时 OnFailure 重启
  • Never 从不重启
properties.sku

ContainerGroupSku

容器组的 SKU。

properties.subnetIds

ContainerGroupSubnetId[]

容器组的子网资源 ID。

properties.volumes

Volume[]

此容器组中的容器可以装载的卷列表。

tags

object

资源标记。

type

string

资源类型。

zones

string[]

容器组的区域。

ContainerGroupDiagnostics

容器组诊断信息。

名称 类型 说明
logAnalytics

LogAnalytics

容器组日志分析信息。

ContainerGroupIdentity

容器组的标识。

名称 类型 说明
principalId

string

容器组标识的主体 ID。 此属性仅针对系统分配的标识提供。

tenantId

string

与容器组关联的租户 ID。 此属性仅针对系统分配的标识提供。

type

ResourceIdentityType

用于容器组的标识类型。 类型“SystemAssigned,UserAssigned”包括隐式创建的标识和一组用户分配的标识。 类型“None”将从容器组中删除任何标识。

userAssignedIdentities

<string,  UserAssignedIdentities>

与容器组关联的用户标识列表。

ContainerGroupIpAddressType

指定 IP 是否向公共 Internet 或专用 VNET 公开。

说明
Private
Public

ContainerGroupNetworkProtocol

与端口关联的协议。

说明
TCP
UDP

ContainerGroupPriority

容器组的优先级。

说明
Regular
Spot

ContainerGroupProperties.properties.InstanceView

容器组的实例视图。 仅在响应中有效。

名称 类型 说明
events

Event[]

此容器组的事件。

state

string

容器组的状态。 仅在响应中有效。

ContainerGroupRestartPolicy

重启容器组中所有容器的策略。

  • Always 始终重启
  • 失败时 OnFailure 重启
  • Never 从不重启
说明
Always
Never
OnFailure

ContainerGroupSku

容器组 SKU。

说明
Confidential
Dedicated
Standard

ContainerGroupSubnetId

容器组子网信息。

名称 类型 说明
id

string

虚拟网络和子网的资源 ID。

name

string

子网的友好名称。

ContainerHttpGet

容器 Http Get 设置,用于实时或就绪情况探测

名称 类型 说明
httpHeaders

HttpHeader[]

HTTP 标头。

path

string

探测的路径。

port

integer (int32)

要探测的端口号。

scheme

Scheme

方案。

ContainerNetworkProtocol

与端口关联的协议。

说明
TCP
UDP

ContainerPort

在容器实例上公开的端口。

名称 类型 说明
port

integer (int32)

容器组中公开的端口号。

protocol

ContainerNetworkProtocol

与端口关联的协议。

ContainerProbe

容器探测,用于生存或就绪情况

名称 类型 说明
exec

ContainerExec

要探测的执行命令

failureThreshold

integer (int32)

失败阈值。

httpGet

ContainerHttpGet

要探测的 Http 获取设置

initialDelaySeconds

integer (int32)

初始延迟秒。

periodSeconds

integer (int32)

时间段秒。

successThreshold

integer (int32)

成功阈值。

timeoutSeconds

integer (int32)

超时秒。

ContainerState

容器实例状态。

名称 类型 说明
detailStatus

string

容器实例状态的可读状态。

exitCode

integer (int32)

容器实例退出代码对应于 docker run 命令中的代码。

finishTime

string (date-time)

容器实例状态完成的日期/时间。

startTime

string (date-time)

容器实例状态启动的日期/时间。

state

string

容器实例的状态。

DeploymentExtensionSpec

要添加到部署中的扩展 sidecar。

名称 类型 说明
name

string

扩展的名称。

properties.extensionType

string

要添加的扩展的类型。

properties.protectedSettings

object

扩展的受保护设置。

properties.settings

object

扩展的设置。

properties.version

string

正在使用的扩展的版本。

DnsConfiguration

容器组的 DNS 配置。

名称 类型 说明
nameServers

string[]

容器组的 DNS 服务器。

options

string

容器组的 DNS 选项。

searchDomains

string

用于在容器组中查找主机名的 DNS 搜索域。

dnsNameLabelReusePolicy

表示安全枚举的值。 如果未选择“不安全”值,则为默认值,表示对象域名标签不受子域接管保护。 如果选中“TenantReuse”值,则为默认值,表示可以在同一租户中重复使用对象的域名标签。 “SubscriptionReuse”值表示可以在同一订阅中重复使用对象的域名标签。 “ResourceGroupReuse”值表示可以在同一资源组中重复使用对象的域名标签。 “NoReuse”值表示不能在同一资源组、订阅或租户中重复使用对象的域名标签。

说明
Noreuse
ResourceGroupReuse
SubscriptionReuse
TenantReuse
Unsecure

EmptyDirVolume

空目录卷。

EncryptionProperties

容器组加密属性。

名称 类型 说明
identity

string

keyvault 托管标识。

keyName

string

加密密钥名称。

keyVersion

string

加密密钥版本。

vaultBaseUrl

string

keyvault 基 URL。

EnvironmentVariable

在容器实例中设置的环境变量。

名称 类型 说明
name

string

环境变量的名称。

secureValue

string

安全环境变量的值。

value

string

环境变量的值。

Event

容器组或容器实例事件。

名称 类型 说明
count

integer (int32)

事件的计数。

firstTimestamp

string (date-time)

最早记录事件的日期时间。

lastTimestamp

string (date-time)

最新记录事件的日期时间。

message

string

事件消息。

name

string

事件名称。

type

string

事件类型。

GitRepoVolume

表示使用 git 存储库的内容填充的卷

名称 类型 说明
directory

string

目标目录名称。 不得包含或以“..”开头。 如果提供了“.”,卷目录将是 git 存储库。 否则,如果指定,卷将包含具有给定名称的子目录中的 git 存储库。

repository

string

存储库 URL

revision

string

指定修订的提交哈希。

GpuResource

GPU 资源。

名称 类型 说明
count

integer (int32)

GPU 资源的计数。

sku

GpuSku

GPU 资源的 SKU。

GpuSku

GPU 资源的 SKU。

说明
K80
P100
V100

HttpHeader

HTTP 标头。

名称 类型 说明
name

string

标头名称。

value

string

标头值。

ImageRegistryCredential

映像注册表凭据。

名称 类型 说明
identity

string

专用注册表的标识。

identityUrl

string

专用注册表的标识 URL。

password

string

专用注册表的密码。

server

string

没有协议(如“http”和“https”)的 Docker 映像注册表服务器。

username

string

专用注册表的用户名。

InitContainerDefinition

init 容器定义。

名称 类型 说明
name

string

init 容器的名称。

properties.command

string[]

要以 exec 形式在 init 容器中执行的命令。

properties.environmentVariables

EnvironmentVariable[]

在 init 容器中设置的环境变量。

properties.image

string

init 容器的图像。

properties.instanceView

InitContainerPropertiesDefinition.InstanceView

init 容器的实例视图。 仅在响应中有效。

properties.securityContext

SecurityContextDefinition

容器安全属性。

properties.volumeMounts

VolumeMount[]

可用于 init 容器的卷装载。

InitContainerPropertiesDefinition.InstanceView

init 容器的实例视图。 仅在响应中有效。

名称 类型 说明
currentState

ContainerState

init 容器的当前状态。

events

Event[]

init 容器的事件。

previousState

ContainerState

init 容器的上一状态。

restartCount

integer (int32)

初始化容器已重启的次数。

InstanceView

容器实例的实例视图。 仅在响应中有效。

名称 类型 说明
currentState

ContainerState

当前容器实例状态。

events

Event[]

容器实例的事件。

previousState

ContainerState

以前的容器实例状态。

restartCount

integer (int32)

容器实例已重启的次数。

IpAddress

容器组的 IP 地址。

名称 类型 默认值 说明
autoGeneratedDomainNameLabelScope

dnsNameLabelReusePolicy

Unsecure

表示安全枚举的值。 如果未选择“不安全”值,则为默认值,表示对象域名标签不受子域接管保护。 如果选中“TenantReuse”值,则为默认值,表示可以在同一租户中重复使用对象的域名标签。 “SubscriptionReuse”值表示可以在同一订阅中重复使用对象的域名标签。 “ResourceGroupReuse”值表示可以在同一资源组中重复使用对象的域名标签。 “NoReuse”值表示不能在同一资源组、订阅或租户中重复使用对象的域名标签。

dnsNameLabel

string

IP 的 Dns 名称标签。

fqdn

string

IP 的 FQDN。

ip

string

公开给公共 Internet 的 IP。

ports

Port[]

容器组上公开的端口列表。

type

ContainerGroupIpAddressType

指定 IP 是否向公共 Internet 或专用 VNET 公开。

LogAnalytics

容器组日志分析信息。

名称 类型 说明
logType

LogAnalyticsLogType

要使用的日志类型。

metadata

object

日志分析的元数据。

workspaceId

string

Log Analytics 的工作区 ID

workspaceKey

string

Log Analytics 的工作区密钥

workspaceResourceId

string

Log Analytics 的工作区资源 ID

LogAnalyticsLogType

要使用的日志类型。

说明
ContainerInsights
ContainerInstanceLogs

OperatingSystemTypes

容器组中容器所需的操作系统类型。

说明
Linux
Windows

Port

容器组上公开的端口。

名称 类型 说明
port

integer (int32)

端口号。

protocol

ContainerGroupNetworkProtocol

与端口关联的协议。

ResourceIdentityType

用于容器组的标识类型。 类型“SystemAssigned,UserAssigned”包括隐式创建的标识和一组用户分配的标识。 类型“None”将从容器组中删除任何标识。

说明
None
SystemAssigned
SystemAssigned, UserAssigned
UserAssigned

ResourceLimits

资源限制。

名称 类型 说明
cpu

number (double)

此容器实例的 CPU 限制。

gpu

GpuResource

此容器实例的 GPU 限制。

memoryInGB

number (double)

此容器实例的内存限制(以 GB 为单位)。

ResourceRequests

资源请求。

名称 类型 说明
cpu

number (double)

此容器实例的 CPU 请求。

gpu

GpuResource

此容器实例的 GPU 请求。

memoryInGB

number (double)

此容器实例的内存请求(以 GB 为单位)。

ResourceRequirements

资源要求。

名称 类型 说明
limits

ResourceLimits

此容器实例的资源限制。

requests

ResourceRequests

此容器实例的资源请求。

Scheme

方案。

说明
http
https

SecurityContextCapabilitiesDefinition

从容器添加或删除的功能。

名称 类型 说明
add

string[]

要添加到容器的功能。

drop

string[]

要从容器中删除的功能。

SecurityContextDefinition

容器的安全上下文。

名称 类型 说明
allowPrivilegeEscalation

boolean

一个布尔值,该值指示 init 进程是否可以提升其特权

capabilities

SecurityContextCapabilitiesDefinition

从容器添加或删除的功能。

privileged

boolean

用于确定容器权限是否提升为 Privileged 的标志。

runAsGroup

integer (int32)

设置容器的用户 GID。

runAsUser

integer (int32)

设置容器的用户 UID。

seccompProfile

string

包含 seccomp 配置文件中 JSON 内容的 base64 编码字符串

UserAssignedIdentities

与容器组关联的用户标识列表。 用户标识字典密钥引用的格式为 ARM 资源 ID:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}”。

名称 类型 说明
clientId

string

用户分配标识的客户端 ID。

principalId

string

用户分配标识的主体 ID。

Volume

卷的属性。

名称 类型 说明
azureFile

AzureFileVolume

Azure 文件卷。

emptyDir

EmptyDirVolume

空目录卷。

gitRepo

GitRepoVolume

git 存储库卷。

name

string

卷的名称。

secret

object

机密卷。

VolumeMount

卷装载的属性。

名称 类型 说明
mountPath

string

应装载卷的容器中的路径。 不得包含冒号 (:)。

name

string

卷装载的名称。

readOnly

boolean

指示卷装载是否为只读的标志。