resources.containers.container definition
コンテナー リソースは、コンテナー イメージを参照します。
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.
この定義を参照する定義: resources.containers
特性
container
文字列。 最初のプロパティとして必要です。
コンテナーの ID。 使用できる値: [-_A-Za-z0-9]*。
image
文字列。 必須。
コンテナー イメージ タグを します。
type
文字列。
ACR や GCR などのレジストリの種類。
resources.containers.container.triggerを trigger
します。
無効にするには none を指定し、すべてのイメージ タグでトリガーする場合は true を指定するか、次の例で説明するように完全な構文を使用します。
endpoint
文字列。
プライベート コンテナー レジストリに接続するサービス エンドポイントの ID。
テンプレート式は、でサポートされています。
endpoint
文字列。
プライベート コンテナー レジストリに接続するサービス エンドポイントの ID。
文字列ディクショナリ env
します。
変数を使用して、コンテナーの環境にマップします。
ブールを mapDockerSocket
します。
コンテナー ジョブで /var/run/docker.sock ボリュームをセットアップしないようにエージェントに強制するには、このフラグを false に設定します。
options
文字列。
コンテナー ホストに渡すオプション。
テンプレート式は、でサポートされています。
options
文字列。
コンテナー ホストに渡すオプション。
文字列リスト ports
します。
コンテナーで公開するポートを します。
テンプレート式は、でサポートされています。
文字列リスト ports
します。
コンテナーで公開するポートを します。
文字列リスト volumes
します。
コンテナーにマウントするボリュームを します。
テンプレート式は、でサポートされています。
文字列リスト volumes
します。
コンテナーにマウントするボリュームを します。
mountReadOnlyを mountReadOnly
します。
読み取り専用をマウントするボリューム 、既定値はすべて false です。
azureSubscription
文字列。
コンテナー レジストリの Azure サブスクリプション (ARM サービス接続) を します。
resourceGroup
文字列。
ACR のリソース グループを します。
registry
文字列。
コンテナー イメージのレジストリを します。
repository
文字列。
ACR のコンテナー イメージ リポジトリの名前。
ブールを localImage
します。
true の場合は、docker pull を使用してイメージを取得する代わりに、ローカルにタグ付けされたイメージを使用します。 既定値は false です。
このプロパティは、イメージがエージェント コンピューターに既に存在するセルフホステッド エージェントにのみ役立ちます。
注釈
コンテナー ジョブ 、コンテナー内でツールと依存関係を分離できます。
エージェントは、指定したコンテナーのインスタンスを起動し、その中でステップを実行します。
container
キーワードを使用すると、コンテナー イメージを指定できます。
Service コンテナー ジョブと共に実行され、データベースなどのさまざまな依存関係が提供されます。
テンプレート式 は、YAML パイプライン内のコンテナー リソースの endpoint
、volumes
、ports
、および 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