definice resources.containers.container

Prostředek kontejneru odkazuje na image kontejneru.

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.

Definice, které odkazují na tuto definici: resources.containers

Vlastnosti

container Řetězec. Požadováno jako první vlastnost.
ID kontejneru. Přijatelné hodnoty: [-_A-Za-z0-9]*.

image Řetězec. Povinná hodnota.
Značka image kontejneru.

type Řetězec.
Typ registru, jako je ACR nebo GCR.

triggerresources.containers.container.trigger.
U všech značek obrázků zadejte hodnotu none, která se má zakázat, hodnotu true nebo použijte úplnou syntaxi, jak je popsáno v následujících příkladech.

endpoint Řetězec.
ID koncového bodu služby, který se připojuje k privátnímu registru kontejneru. Podporují se výrazy šablon.

endpoint Řetězec.
ID koncového bodu služby, který se připojuje k privátnímu registru kontejneru.

env slovník řetězců.
Proměnné, které se mají mapovat na prostředí kontejneru.

mapDockerSocketlogická hodnota.
Pokud chcete, aby agent nenastavil svazek /var/run/docker.sock pro úlohy kontejneru, nastavte tento příznak na false.

options Řetězec.
Možnosti předání do hostitele kontejneru Podporují se výrazy šablon.

options Řetězec.
Možnosti předání do hostitele kontejneru

ports seznam řetězců.
Porty, které se mají zveřejnit v kontejneru. Podporují se výrazy šablon.

ports seznam řetězců.
Porty, které se mají zveřejnit v kontejneru.

volumes seznam řetězců.
Svazky, které se mají připojit k kontejneru. Podporují se výrazy šablon.

volumes seznam řetězců.
Svazky, které se mají připojit k kontejneru.

mountReadOnlymountReadOnly.
Svazky pro připojení jen pro čtení, výchozí hodnota je false.

azureSubscription Řetězec.
Předplatné Azure (připojení služby ARM) pro registr kontejneru

resourceGroup Řetězec.
Skupina prostředků pro ACR.

registry Řetězec.
Registr pro image kontejnerů.

repository Řetězec.
Název úložiště imagí kontejneru v ACR

localImagelogická hodnota.
Pokud je hodnota true, použije k získání image místně označenou image místo použití příkazu docker pull. Výchozí hodnotou je hodnota false.

Tato vlastnost je užitečná jenom pro agenty v místním prostředí, kde se image už na počítači agenta nachází.

Poznámky

Úlohy kontejnerů umožňují izolovat nástroje a závislosti uvnitř kontejneru.

Agent spustí instanci zadaného kontejneru a pak v něm spustí kroky. Klíčové container slovo umožňuje zadat image kontejneru.

Kontejnery služeb běží společně s úlohou a poskytují různé závislosti, jako jsou databáze.

Výrazy šablon se podporují pro endpointvlastnosti , volumes, portsa options prostředku kontejneru v kanálu YAML.

Příklady

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

Viz také

Definování prostředků v YAML