resources.containers.container 定義

コンテナー リソースは、コンテナー イメージを参照します。

containers:
- container: string # Required as first property. Alias of the container.
  image: string # Required. Container image tag.
  type: string # Type of the registry like ACR or GCR.
  trigger: trigger | none | true # Specify none to disable, true to trigger on all image tags, or use the full syntax as described in the following examples.
  endpoint: string # ID of the service endpoint connecting to a private container registry.
  env: # Variables to map into the container's environment.
    string: string # Name/value pairs
  mapDockerSocket: boolean # Set this flag to false to force the agent not to setup the /var/run/docker.sock volume on container jobs.
  options: string # Options to pass into container host.
  ports: [ string ] # Ports to expose on the container.
  volumes: [ string ] # Volumes to mount on the container.
  mountReadOnly: # Volumes to mount read-only, the default is all false.
    work: boolean # Mount the work directory as readonly.
    externals: boolean # Mount the externals directory as readonly.
    tools: boolean # Mount the tools directory as readonly.
    tasks: boolean # Mount the tasks directory as readonly.
  azureSubscription: string # Azure subscription (ARM service connection) for container registry.
  resourceGroup: string # Resource group for your ACR.
  registry: string # Registry for container images.
  repository: string # Name of the container image repository in ACR.
  localImage: boolean # When true, uses a locally tagged image instead of using docker pull to get the image. The default is false.
containers:
- container: string # Required as first property. Alias of the container.
  type: string # Type of the registry like ACR or GCR.
  endpoint: string # ID of the service endpoint connecting to a private container registry.
  trigger: trigger | none | true # Specify none to disable, true to trigger on all image tags, or use the full syntax as described in the following examples.
  azureSubscription: string # Azure subscription (ARM service connection) for container registry.
  resourceGroup: string # Resource group for your ACR.
  registry: string # Registry for container images.
  repository: string # Name of the container image repository in ACR.
  localImage: boolean # When true, uses a locally tagged image instead of using docker pull to get the image. The default is false.
containers:
- container: string # Required as first property. Alias of the container.
  endpoint: string # ID of the service endpoint connecting to a private container registry.
  azureSubscription: string # Azure subscription (ARM service connection) for container registry.
  resourceGroup: string # Resource group for your ACR.
  registry: string # Registry for container images.
  repository: string # Name of the container image repository in ACR.
  localImage: boolean # When true, uses a locally tagged image instead of using docker pull to get the image. The default is false.

この定義を参照する定義: resources.containers

プロパティ

container 文字列。 最初のプロパティとして必須。
コンテナーの ID。 使用できる値: [-_A-Za-z0-9]*

image 文字列。 必須。
コンテナー イメージ タグ。

type 文字列。
ACR や GCR などのレジストリの種類。

triggerresources.containers.container.trigger
無効にする場合は none、すべてのイメージ タグでトリガーする場合は true を指定するか、次の例で説明するように完全な構文を使用します。

endpoint 文字列。
プライベート コンテナー レジストリに接続するサービス エンドポイントの ID。 テンプレート式がサポートされています

endpoint 文字列。
プライベート コンテナー レジストリに接続するサービス エンドポイントの ID。

env 文字列ディクショナリ。
コンテナーの環境にマップする変数。

mapDockerSocketboolean
コンテナー ジョブで /var/run/docker.sock ボリュームを設定しないようにエージェントを強制するには、このフラグを false に設定します。

options 文字列。
コンテナー ホストに渡すオプション。 テンプレート式がサポートされています

options 文字列。
コンテナー ホストに渡すオプション。

ports 文字列リスト。
コンテナーで公開するポート。 テンプレート式がサポートされています

ports 文字列リスト。
コンテナーで公開するポート。

volumes 文字列リスト。
コンテナーにマウントするボリューム。 テンプレート式がサポートされています

volumes 文字列リスト。
コンテナーにマウントするボリューム。

mountReadOnlymountReadOnly
読み取り専用でマウントするボリューム。既定値はすべて false です。

azureSubscription 文字列。
コンテナー レジストリの Azure サブスクリプション (ARM サービス接続)。

resourceGroup 文字列。
ACR のリソース グループ。

registry 文字列。
コンテナー イメージのレジストリ。

repository 文字列。
ACR のコンテナー イメージ リポジトリの名前。

localImageboolean
true の場合、docker pull を使用してイメージを取得する代わりに、ローカルにタグ付けされたイメージを使用します。 既定値は false です。

このプロパティは、イメージがエージェント コンピューターに既に存在するセルフホステッド エージェントにのみ役立ちます。

注釈

コンテナー ジョブを使うと、コンテナー内のツールと依存関係を分離できます。

エージェントは、指定されたコンテナーのインスタンスを起動してから、その内部のステップを実行します。 container キーワードを使うと、コンテナー イメージを指定できます。

サービス コンテナーは、ジョブと共に実行されて、データベースなどのさまざまな依存関係を提供します。

テンプレート式 は、YAML パイプラインの endpointコンテナー リソースの 、 volumesports、および options プロパティでサポートされています。

resources:
  containers:
  - container: linux
    image: ubuntu:16.04
  - container: windows
    image: myprivate.azurecr.io/windowsservercore:1803
    endpoint: my_acr_connection
  - container: my_service
    image: my_service:tag
    ports:
    - 8080:80 # bind container port 80 to 8080 on the host machine
    - 6379 # bind container port 6379 to a random available port on the host machine
    volumes:
    - /src/dir:/dst/dir # mount /src/dir on the host into /dst/dir in the container

関連項目

YAML でリソースを定義する