YAML リファレンス: Azure Container Instances

この記事では、コンテナー グループを構成するためにAzure Container Instancesでサポートされる YAML ファイルの構文とプロパティについて説明します。 YAML ファイルを使用して、Azure CLIの az container create コマンドにグループ構成を入力します。

YAML ファイルは、再現可能なデプロイ用にコンテナー グループを構成する便利な方法です。 これは、Resource Manager テンプレートまたはAzure Container Instances SDK を使用してコンテナー グループを作成または更新する簡潔な代替手段です。

Note

このリファレンスは、AZURE CONTAINER INSTANCES REST API バージョンの2021-10-01の YAML ファイルに適用されます。

Schema

YAML ファイルのスキーマは、主なプロパティを強調表示するためのコメントを含め、次のとおりです。 このスキーマのプロパティの説明については、「 プロパティ値」 セクションを参照してください。

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
    autoGeneratedDomainNameLabelScope: 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

プロパティ値

次の表では、スキーマで設定する必要がある値について説明します。

Microsoft。ContainerInstance/containerGroups オブジェクト

名前 タイプ 必須 価値
名前 文字列 Yes コンテナー グループの名前。
apiVersion 列挙型 Yes 2021-10-01 (最新)、2021-09-01、2021-07-01、2021-03-01、 2020-11-01、2019-12-01、2018-10-01、2018-09-01、2018-07-01、2018-06-01、2018-04-01
位置 文字列 いいえ リソースの場所。
tags オブジェクト いいえ リソース タグ。
ID オブジェクト いいえ 構成されている場合は、コンテナー グループの ID。 - ContainerGroupIdentity オブジェクト
properties オブジェクト Yes ContainerGroupProperties オブジェクト

ContainerGroupIdentity オブジェクト

名前 タイプ 必須 価値
列挙型 いいえ コンテナー グループに使用される ID の種類。 型 'SystemAssigned, UserAssigned' には、暗黙的に作成された ID とユーザー割り当て ID のセットの両方が含まれます。 型 'None' は、コンテナー グループからすべての ID を削除します。 - SystemAssigned、UserAssigned、SystemAssigned、UserAssigned、None
userAssignedIdentities オブジェクト いいえ コンテナー グループに関連付けられているユーザー ID の一覧。 ユーザー ID ディクショナリ のキー参照は、'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft の形式でAzure Resource Managerリソース ID です。ManagedIdentity/userAssignedIdentities/{identityName}'。

ContainerGroupProperties オブジェクト

名前 タイプ 必須 価値
コンテナー アレイ Yes コンテナー グループ内のコンテナー。 - Container オブジェクト
imageRegistryCredentials アレイ いいえ コンテナー グループの作成元のイメージ レジストリ資格情報。 - ImageRegistryCredential オブジェクト
restartPolicy 列挙型 いいえ コンテナー グループ内のすべてのコンテナーのポリシーを再起動します。 - Always 常に再起動- OnFailure 失敗した場合の再起動- Never 再起動しない。 - Always、OnFailure、Never
ipAddress オブジェクト いいえ コンテナー グループの IP アドレスの種類。 - IpAddress オブジェクト
osTypeの 列挙型 Yes コンテナー グループ内のコンテナーに必要なオペレーティング システムの種類。 - Windowsまたは Linux
volumes アレイ いいえ このコンテナー グループ内のコンテナーがマウントできるボリュームの一覧。 - Volume オブジェクト
diagnostics オブジェクト いいえ コンテナー グループの診断情報。 - ContainerGroupDiagnostics オブジェクト
サブネットID オブジェクト いいえ コンテナー グループのサブネット情報。 - ContainerGroupSubnetIds オブジェクト
dnsConfigの オブジェクト いいえ コンテナー グループの DNS 構成情報。 - DnsConfiguration オブジェクト
sku 列挙型 いいえ コンテナー グループの SKU (Standard または Dedicated)
暗号化プロパティ オブジェクト いいえ コンテナー グループの暗号化プロパティ。 - EncryptionProperties オブジェクト
initコンテナ アレイ いいえ コンテナー グループの init コンテナー。 - InitContainerDefinition オブジェクト

Container オブジェクト

名前 タイプ 必須 価値
名前 文字列 Yes コンテナー インスタンスのユーザー指定の名前。
properties オブジェクト Yes コンテナー インスタンスのプロパティ。 - ContainerProperties オブジェクト

ImageRegistryCredential オブジェクト

名前 タイプ 必須 価値
サーバー 文字列 Yes "http" や "https" などのプロトコルのない Docker イメージ レジストリ サーバー。
ユーザー名 文字列 いいえ プライベート レジストリのユーザー名。
パスワード 文字列 いいえ プライベート レジストリのパスワード。
ID 文字列 いいえ 認証に使用されるユーザー割り当てマネージド ID のリソース ID。 ACR イメージ プルでは、システム割り当てマネージド ID はサポートされていません。
アイデンティティURL 文字列 いいえ プライベート レジストリの ID URL。

IpAddress オブジェクト

名前 タイプ 必須 価値
ports アレイ Yes コンテナー グループで公開されているポートの一覧。 - Port オブジェクト
列挙型 Yes IP がパブリック インターネットまたはプライベート仮想ネットワークに公開されるかどうかを指定します。 - パブリックまたはプライベート
IPアドレス 文字列 いいえ パブリック インターネットに公開されている IP。
dnsNameラベル 文字列 いいえ IP の Dns 名ラベル。

Volume オブジェクト

名前 タイプ 必須 価値
名前 文字列 Yes ボリュームの名前。
azureファイルの場合 オブジェクト いいえ Azure File ボリューム。 - AzureFileVolume オブジェクト
emptyDir オブジェクト いいえ 空のディレクトリ ボリューム。
シークレット オブジェクト いいえ シークレット ボリューム。
gitRepo の オブジェクト いいえ Git リポジトリ ボリューム。 - GitRepoVolume オブジェクト

ContainerGroupDiagnostics オブジェクト

名前 タイプ 必須 価値
ログアナリティクス オブジェクト いいえ コンテナー グループのログ分析情報。 - LogAnalytics オブジェクト

ContainerGroupSubnetIds オブジェクト

名前 タイプ 必須 価値
id 文字列 Yes サブネットの識別子。
名前 文字列 いいえ サブネットの名前。

DnsConfiguration オブジェクト

名前 タイプ 必須 価値
ネームサーバー アレイ Yes コンテナー グループの DNS サーバー。 -文字列
検索ドメイン 文字列 いいえ コンテナー グループ内のホスト名検索の DNS 検索ドメイン。
options 文字列 いいえ コンテナー グループの DNS オプション。

EncryptionProperties オブジェクト

名前 タイプ 必須 価値
vaultBaseUrl 文字列 Yes keyvault のベース URL。
キー名 文字列 Yes 暗号化キーの名前。
キーバージョン 文字列 Yes 暗号化キーのバージョン。

InitContainerDefinition オブジェクト

名前 タイプ 必須 価値
名前 文字列 Yes init コンテナーの名前。
properties オブジェクト Yes init コンテナーのプロパティ。 - InitContainerPropertiesDefinition オブジェクト

ContainerProperties オブジェクト

名前 タイプ 必須 価値
イメージ 文字列 Yes コンテナー インスタンスの作成に使用されるイメージの名前。
command アレイ いいえ コンテナー インスタンス内で exec 形式で実行するコマンド。 - string
ports アレイ いいえ コンテナー インスタンスで公開されているポート。 - ContainerPort オブジェクト
environmentVariables アレイ いいえ コンテナー インスタンスで設定する環境変数。 - EnvironmentVariable オブジェクト
resources オブジェクト Yes コンテナー インスタンスのリソース要件。 - ResourceRequirements オブジェクト
ボリュームマウント アレイ いいえ コンテナー インスタンスで使用できるボリューム マウント。 - VolumeMount オブジェクト
livenessプローブ オブジェクト いいえ ライブネス プローブ。 - ContainerProbe オブジェクト
準備プローブ オブジェクト いいえ 準備プローブ。 - ContainerProbe オブジェクト

Port オブジェクト

名前 タイプ 必須 価値
プロトコル 列挙型 いいえ ポートに関連付けられているプロトコル。 - TCP または UDP
ポート 整数 Yes ポート番号。

AzureFileVolume オブジェクト

名前 タイプ 必須 価値
shareName 文字列 Yes ボリュームとしてマウントする Azure ファイル共有の名前。
読み取り専用 boolean いいえ ボリュームとしてマウントされた Azure File 共有が読み取り専用かどうかを示すフラグ。
storageAccountName 文字列 Yes Azure ファイル共有を含むストレージ アカウントの名前。
storageAccountKey (ストレージアカウントキー) 文字列 いいえ Azure ファイル共有へのアクセスに使用されるストレージ アカウント アクセス キー。

GitRepoVolume オブジェクト

名前 タイプ 必須 価値
ディレクトリ 文字列 いいえ ターゲット ディレクトリ名。 '..' を含めたり、先頭に含めたりすることはできません。 '.' が指定されている場合、ボリューム ディレクトリは Git リポジトリです。 それ以外の場合、指定した名前のサブディレクトリに git リポジトリがボリュームに含まれます。
リポジトリ 文字列 Yes リポジトリ URL
改訂 文字列 いいえ 指定したリビジョンのコミット ハッシュ。

LogAnalytics オブジェクト

名前 タイプ 必須 価値
workspaceId 文字列 Yes ログ分析のワークスペース ID
ワークスペースキー 文字列 Yes ログ分析のワークスペース キー
ワークスペースリソースID 文字列 いいえ ログ分析のワークスペース リソース ID
ログタイプ 列挙型 いいえ 使用するログの種類。 - ContainerInsights または ContainerInstanceLogs
メタデータ オブジェクト いいえ ログ分析のメタデータ。

InitContainerPropertiesDefinition オブジェクト

名前 タイプ 必須 価値
イメージ 文字列 いいえ init コンテナーのイメージ。
command アレイ いいえ init コンテナー内で exec 形式で実行するコマンド。 -文字列
environmentVariables アレイ いいえ init コンテナーで設定する環境変数。 - EnvironmentVariable オブジェクト
ボリュームマウント アレイ いいえ init コンテナーで使用できるボリューム マウント。 - VolumeMount オブジェクト

ContainerPort オブジェクト

名前 タイプ 必須 価値
プロトコル 列挙型 いいえ ポートに関連付けられているプロトコル。 - TCP または UDP
ポート 整数 Yes コンテナー グループ内で公開されるポート番号。

EnvironmentVariable オブジェクト

名前 タイプ 必須 価値
名前 文字列 Yes 環境変数の名前。
value 文字列 いいえ 環境変数の値。
セキュアバリュー 文字列 いいえ セキュリティで保護された環境変数の値。

ResourceRequirements オブジェクト

名前 タイプ 必須 価値
requests オブジェクト Yes このコンテナー インスタンスのリソース要求。 - ResourceRequests オブジェクト
制限 オブジェクト いいえ このコンテナー インスタンスのリソース制限。 - ResourceLimits オブジェクト

VolumeMount オブジェクト

名前 タイプ 必須 価値
名前 文字列 Yes ボリューム マウントの名前。
マウントパス 文字列 Yes ボリュームをマウントするコンテナー内のパス。 コロン (:)を含めてはなりません。
読み取り専用 boolean いいえ ボリューム マウントが読み取り専用かどうかを示すフラグ。

ContainerProbe オブジェクト

名前 タイプ 必須 価値
exec オブジェクト いいえ プローブする実行コマンド - ContainerExec オブジェクト
httpゲット オブジェクト いいえ プローブする Http Get 設定 - ContainerHttpGet オブジェクト
initialDelaySeconds (初期遅延秒) 整数 いいえ 最初の遅延秒数。
period秒 整数 いいえ 期間 (秒)。
failureThreshold 整数 いいえ エラーのしきい値。
successThreshold(成功のしきい値) 整数 いいえ 成功のしきい値。
timeoutSeconds 整数 いいえ タイムアウト秒数。

ResourceRequests オブジェクト

名前 タイプ 必須 価値
memoryInGB number Yes このコンテナー インスタンスのメモリ要求 (GB 単位)。
CPUの number Yes このコンテナー インスタンスの CPU 要求。
gpu オブジェクト いいえ このコンテナー インスタンスの GPU 要求。 - GpuResource オブジェクト

ResourceLimits オブジェクト

名前 タイプ 必須 価値
memoryInGB number いいえ このコンテナー インスタンスのメモリ制限 (GB 単位)。
CPUの number いいえ このコンテナー インスタンスの CPU 制限。
gpu オブジェクト いいえ このコンテナー インスタンスの GPU 制限。 - GpuResource オブジェクト

ContainerExec オブジェクト

名前 タイプ 必須 価値
command アレイ いいえ コンテナー内で実行するコマンド。 -文字列

ContainerHttpGet オブジェクト

名前 タイプ 必須 価値
パス 文字列 いいえ プローブするパス。
ポート 整数 Yes プローブするポート番号。
scheme 列挙型 いいえ スキーム。 - http または https
HTTPヘッダー オブジェクト いいえ プローブに含まれる HTTP ヘッダー。 - HttpHeaders オブジェクト

HttpHeaders オブジェクト

名前 タイプ 必須 価値
名前 文字列 いいえ ヘッダーの名前。
value 文字列 いいえ ヘッダーの値。

Important

K80 および P100 GPU SKU は、2023 年 8 月 31 日までに廃止されます。 これは、使用されている基になる VM (NC シリーズNCv2 シリーズ) が廃止されたためです。V100 SKU は使用可能になりますが、代わりにAzure Kubernetes Serviceを使用するように再検討されます。 GPU リソースは完全にはサポートされていないため、運用環境のワークロードには使用しないでください。 AKS に今すぐ移行するには、次のリソース を使用します。AKS に移行する方法

GpuResource オブジェクト

名前 タイプ 必須 価値
count 整数 Yes GPU リソースの数。
sku 列挙型 Yes GPU リソースの SKU。 - V100

次のステップ

チュートリアル「YAML ファイルを使用して複数コンテナー グループをデプロイする」を参照してください。

YAML ファイルを使用して 、仮想ネットワーク または 外部ボリュームをマウントするコンテナー グループをデプロイする例を参照してください。