다음을 통해 공유


resources.containers.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.
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.

이 정의를 참조하는 정의: resources.containers

속성

container 문자열. 첫 번째 속성으로 필요합니다.
컨테이너의 ID입니다. 허용되는 값: [-_A-Za-z0-9]*.

image 문자열. 필수 사항입니다.
컨테이너 이미지 태그입니다.

type 문자열.
ACR 또는 GCR과 같은 레지스트리의 유형입니다.

triggerresources.containers.container.trigger.
사용하지 않도록 설정하려면 없음을 지정하고, 모든 이미지 태그에서 트리거하려면 true를 지정하거나, 다음 예제에 설명된 대로 전체 구문을 사용합니다.

endpoint 문자열.
프라이빗 컨테이너 레지스트리에 연결하는 서비스 엔드포인트의 ID입니다. 템플릿 식이 지원됩니다.

endpoint 문자열.
프라이빗 컨테이너 레지스트리에 연결하는 서비스 엔드포인트의 ID입니다.

env 문자열 사전입니다.
컨테이너의 환경에 매핑할 변수입니다.

mapDockerSocketboolean입니다.
에이전트가 컨테이너 작업에서 /var/run/docker.sock 볼륨을 설정하지 않도록 하려면 이 플래그를 false로 설정합니다.

options 문자열.
컨테이너 호스트에 전달할 옵션입니다. 템플릿 식이 지원됩니다.

options 문자열.
컨테이너 호스트에 전달할 옵션입니다.

ports 문자열 목록입니다.
컨테이너에 노출할 포트입니다. 템플릿 식이 지원됩니다.

ports 문자열 목록입니다.
컨테이너에 노출할 포트입니다.

volumes 문자열 목록입니다.
컨테이너에 탑재할 볼륨입니다. 템플릿 식이 지원됩니다.

volumes 문자열 목록입니다.
컨테이너에 탑재할 볼륨입니다.

mountReadOnlymountReadOnly.
읽기 전용으로 탑재할 볼륨의 기본값은 모두 false입니다.

azureSubscription 문자열.
컨테이너 레지스트리에 대한 AZURE 구독(ARM 서비스 연결)입니다.

resourceGroup 문자열.
ACR에 대한 리소스 그룹입니다.

registry 문자열.
컨테이너 이미지에 대한 레지스트리입니다.

repository 문자열.
ACR의 컨테이너 이미지 리포지토리 이름입니다.

localImageboolean입니다.
true이면 docker pull을 사용하여 이미지를 가져오는 대신 로컬로 태그가 지정된 이미지를 사용합니다. 기본값은 false입니다.

이 속성은 이미지가 에이전트 컴퓨터에 이미 있는 자체 호스팅 에이전트에만 유용합니다.

설명

컨테이너 작업을 사용하면 컨테이너 내에서 도구와 종속성을 격리할 수 있습니다.

에이전트는 지정된 컨테이너의 인스턴스를 시작하고 그 안에 있는 단계를 실행합니다. container 키워드(keyword) 컨테이너 이미지를 지정할 수 있습니다.

서비스 컨테이너는 작업과 함께 실행하여 데이터베이스와 같은 다양한 종속성을 제공합니다.

템플릿 식 은 YAML 파이프라인에서 endpoint컨테이너 리소스의 , volumes, portsoptions 속성에 대해 지원됩니다.

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에서 리소스 정의