resources.containers.container definition

Zasób kontenera odwołuje się do obrazu kontenera.

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.

Definicje odwołujące się do tej definicji: resources.containers

Właściwości

container Ciąg. Wymagane jako pierwsza właściwość.
Identyfikator kontenera. Dopuszczalne wartości: [-_A-Za-z0-9]*.

image Ciąg. Wymagane.
Tag obrazu kontenera.

type Ciąg.
Typ rejestru, takiego jak ACR lub GCR.

triggerresources.containers.container.trigger.
Określ brak do wyłączenia, wartość true do wyzwolenia we wszystkich tagach obrazów lub użyj pełnej składni, jak opisano w poniższych przykładach.

endpoint Ciąg.
Identyfikator punktu końcowego usługi łączącego się z prywatnym rejestrem kontenerów. Obsługiwane są wyrażenia szablonów.

endpoint Ciąg.
Identyfikator punktu końcowego usługi łączącego się z prywatnym rejestrem kontenerów.

env słownik ciągów.
Zmienne do mapowania do środowiska kontenera.

mapDockerSocketwartość logiczna.
Ustaw tę flagę na wartość false, aby wymusić, aby agent nie skonfigurował woluminu /var/run/docker.sock w zadaniach kontenera.

options Ciąg.
Opcje przekazywania do hosta kontenera. Obsługiwane są wyrażenia szablonów.

options Ciąg.
Opcje przekazywania do hosta kontenera.

ports lista ciągów.
Porty do uwidocznienia w kontenerze. Obsługiwane są wyrażenia szablonów.

ports lista ciągów.
Porty do uwidocznienia w kontenerze.

volumes lista ciągów.
Woluminy do zainstalowania w kontenerze. Obsługiwane są wyrażenia szablonów.

volumes lista ciągów.
Woluminy do zainstalowania w kontenerze.

mountReadOnlymountReadOnly.
Woluminy do zainstalowania tylko do odczytu, wartość domyślna to fałsz.

azureSubscription Ciąg.
Subskrypcja platformy Azure (połączenie usługi ARM) dla rejestru kontenerów.

resourceGroup Ciąg.
Grupa zasobów dla usługi ACR.

registry Ciąg.
Rejestr obrazów kontenerów.

repository Ciąg.
Nazwa repozytorium obrazów kontenera w usłudze ACR.

localImagewartość logiczna.
W przypadku wartości true użyje lokalnie oznakowanego obrazu zamiast ściągnięcia platformy Docker, aby pobrać obraz. Wartością domyślną jest false.

Ta właściwość jest przydatna tylko w przypadku własnych agentów, na których obraz jest już obecny na maszynie agenta.

Uwagi

Zadania kontenera umożliwiają izolowanie narzędzi i zależności wewnątrz kontenera.

Agent uruchamia wystąpienie określonego kontenera, a następnie uruchamia kroki wewnątrz niego. Słowo container kluczowe umożliwia określenie obrazów kontenerów.

Kontenery usługi są uruchamiane wraz z zadaniem w celu zapewnienia różnych zależności, takich jak bazy danych.

Wyrażenia szablonów są obsługiwane dla endpointwłaściwości , volumes, portsi options zasobu kontenera w potoku YAML.

Przykłady

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

Zobacz też

Definiowanie zasobów w języku YAML