Поделиться через


Определение resources.container.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.

Определения, ссылающиеся на это определение: resources.containers

Свойства

строка container. Обязательный в качестве первого свойства.
идентификатор контейнера. Допустимые значения: [-_A-Za-z0-9]*.

строка image. Обязательное.
тег образа контейнера .

строка type.
тип реестра, например ACR или GCR.

trigger resources.container.container.trigger.
Укажите значение none, true, чтобы активировать все теги изображений или использовать полный синтаксис, как описано в следующих примерах.

строка endpoint.
идентификатор конечной точки службы, подключающейся к частному реестру контейнеров. выражения шаблона поддерживаются.

строка endpoint.
идентификатор конечной точки службы, подключающейся к частному реестру контейнеров.

env словарь строк.
Переменные для сопоставления с средой контейнера.

mapDockerSocket логические.
Задайте для этого флага значение false, чтобы агент не настраивал том /var/run/docker.sock в заданиях контейнера.

строка options.
Параметры для передачи в узел контейнера. выражения шаблона поддерживаются.

строка options.
Параметры для передачи в узел контейнера.

ports строковый список.
порты для предоставления в контейнере. выражения шаблона поддерживаются.

ports строковый список.
порты для предоставления в контейнере.

volumes строковый список.
тома для подключения к контейнеру. выражения шаблона поддерживаются.

volumes строковый список.
тома для подключения к контейнеру.

mountReadOnly mountReadOnly.
тома для подключения только для чтения значение по умолчанию равно false.

строка azureSubscription.
подписке Azure (подключение к службе ARM) для реестра контейнеров.

строка resourceGroup.
группу ресурсов для ACR.

строка registry.
Реестра для образов контейнеров.

строка repository.
Имя репозитория образов контейнера в ACR.

localImage логические.
Если значение true, использует локально помеченное изображение вместо использования извлечения docker для получения изображения. Значение по умолчанию — false.

Это свойство полезно только для локальных агентов, где образ уже присутствует на компьютере агента.

Замечания

задания контейнеров позволяют изолировать средства и зависимости внутри контейнера.

Агент запускает экземпляр указанного контейнера, а затем выполняет шаги внутри него. Ключевое слово container позволяет указать образы контейнеров.

контейнеры служб запускать вместе с заданием, чтобы обеспечить различные зависимости, такие как базы данных.

выражения шаблонов поддерживаются для endpoint, volumes, portsи options свойств ресурса контейнера в конвейере YAML.

Примеры

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