resources.containers.container definition

Eine Containerressource verweist auf ein Containerimage.

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.

Definitionen, die auf diese Definition verweisen: resources.containers

Eigenschaften

container Schnur. Erforderlich als erste Eigenschaft.
ID für den Container. Zulässige Werte: [-_A-Za-z0-9]*.

image Schnur. Erforderlich.
Containerimagetag.

type Schnur.
Registrierungstyp wie ACR oder GCR.

triggerresources.containers.container.trigger.
Geben Sie none to disable, true an, um für alle Bildtags auszulösen, oder verwenden Sie die vollständige Syntax, wie in den folgenden Beispielen beschrieben.

endpoint Schnur.
ID des Dienstendpunkts, der eine Verbindung mit einer privaten Containerregistrierung herstellt. Vorlagenausdrücke werden unterstützt.

endpoint Schnur.
ID des Dienstendpunkts, der eine Verbindung mit einer privaten Containerregistrierung herstellt.

env Zeichenfolgenwörterbuch.
Variablen, die der Umgebung des Containers zugeordnet werden sollen.

mapDockerSocketBoolescher Wert.
Legen Sie dieses Flag auf false fest, um zu erzwingen, dass der Agent das Volume "/var/run/docker.sock" für Containeraufträge nicht einrichten kann.

options Schnur.
Optionen für die Übergabe an den Containerhost. Vorlagenausdrücke werden unterstützt.

options Schnur.
Optionen für die Übergabe an den Containerhost.

ports Zeichenfolgenliste.
Ports, die für den Container verfügbar gemacht werden sollen. Vorlagenausdrücke werden unterstützt.

ports Zeichenfolgenliste.
Ports, die für den Container verfügbar gemacht werden sollen.

volumes Zeichenfolgenliste.
Volumes, die im Container bereitgestellt werden sollen. Vorlagenausdrücke werden unterstützt.

volumes Zeichenfolgenliste.
Volumes, die im Container bereitgestellt werden sollen.

mountReadOnlymountReadOnly.
Volumes, die schreibgeschützt eingebunden werden sollen. Der Standardwert ist "false".

azureSubscription Schnur.
Azure-Abonnement (ARM-Dienstverbindung) für die Containerregistrierung.

resourceGroup Schnur.
Ressourcengruppe für Ihre ACR.

registry Schnur.
Registrierung für Containerimages.

repository Schnur.
Name des Containerimagerepositorys in ACR.

localImageBoolescher Wert.
Wenn true, verwendet ein lokal markiertes Image anstelle von Docker-Pull, um das Image abzurufen. Die Standardeinstellung ist „false“.

Diese Eigenschaft ist nur für selbstgehostete Agents nützlich, bei denen das Image bereits auf dem Agentcomputer vorhanden ist.

Hinweise

Mit Containeraufträgen können Sie Ihre Tools und Abhängigkeiten innerhalb eines Containers isolieren.

Der Agent startet eine Instanz des angegebenen Containers und führt dann die Schritte darin aus. Mit dem container-Schlüsselwort können Sie Ihre Containerimages angeben.

Dienstcontainer werden zusammen mit einem Auftrag ausgeführt, um verschiedene Abhängigkeiten wie Datenbanken bereitzustellen.

Vorlagenausdrücke werden für endpointdie Eigenschaften , volumes, portsund options einer Containerressource in einer YAML-Pipeline unterstützt.

Beispiele

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

Weitere Informationen

Definieren von Ressourcen in YAML