다음을 통해 공유


DockerCompose@1 - Docker Compose v1 작업

다중 컨테이너 Docker 애플리케이션을 빌드, 푸시 또는 실행합니다. Docker 또는 Azure Container Registry와 함께 작업을 사용할 수 있습니다.

문법

# Docker Compose v1
# Build, push or run multi-container Docker applications. Task can be used with Docker or Azure Container registry.
- task: DockerCompose@1
  inputs:
    containerregistrytype: 'Azure Container Registry' # 'Azure Container Registry' | 'Container Registry'. Required. Container Registry Type. Default: Azure Container Registry.
    #dockerRegistryEndpoint: # string. Optional. Use when containerregistrytype = Container Registry. Docker Registry Service Connection. 
    #azureSubscription: # string. Alias: azureSubscriptionEndpoint. Optional. Use when containerregistrytype = Azure Container Registry. Azure subscription. 
    #azureContainerRegistry: # string. Optional. Use when containerregistrytype = Azure Container Registry. Azure Container Registry. 
    dockerComposeFile: '**/docker-compose.yml' # string. Required. Docker Compose File. Default: **/docker-compose.yml.
    #additionalDockerComposeFiles: # string. Additional Docker Compose Files. 
    #dockerComposeFileArgs: # string. Environment Variables. 
    #projectName: '$(Build.Repository.Name)' # string. Project Name. Default: $(Build.Repository.Name).
    #qualifyImageNames: true # boolean. Qualify Image Names. Default: true.
    action: 'Run a Docker Compose command' # 'Build services' | 'Push services' | 'Run services' | 'Run a specific service' | 'Lock services' | 'Write service image digests' | 'Combine configuration' | 'Run a Docker Compose command'. Required. Action. Default: Run a Docker Compose command.
    #additionalImageTags: # string. Optional. Use when action = Build services || action = Push services. Additional Image Tags. 
    #includeSourceTags: false # boolean. Optional. Use when action = Build services || action = Push services. Include Source Tags. Default: false.
    #includeLatestTag: false # boolean. Optional. Use when action = Build services || action = Push services. Include Latest Tag. Default: false.
    #buildImages: true # boolean. Optional. Use when action = Run services. Build Images. Default: true.
    #serviceName: # string. Required when action = Run a specific service. Service Name. 
    #containerName: # string. Optional. Use when action = Run a specific service. Container Name. 
    #ports: # string. Optional. Use when action = Run a specific service. Ports. 
    #workingDirectory: # string. Alias: workDir. Optional. Use when action = Run a specific service. Working Directory. 
    #entrypoint: # string. Optional. Use when action = Run a specific service. Entry Point Override. 
    #containerCommand: # string. Optional. Use when action = Run a specific service. Command. 
    #detached: true # boolean. Optional. Use when action = Run services || action = Run a specific service. Run in Background. Default: true.
    #abortOnContainerExit: true # boolean. Optional. Use when action = Run services && detached == false. Abort on Container Exit. Default: true.
    #imageDigestComposeFile: '$(Build.StagingDirectory)/docker-compose.images.yml' # string. Required when action = Write service image digests. Image Digest Compose File. Default: $(Build.StagingDirectory)/docker-compose.images.yml.
    #removeBuildOptions: false # boolean. Optional. Use when action = Lock services || action = Combine configuration. Remove Build Options. Default: false.
    #baseResolveDirectory: # string. Optional. Use when action = Lock services || action = Combine configuration. Base Resolve Directory. 
    #outputDockerComposeFile: '$(Build.StagingDirectory)/docker-compose.yml' # string. Required when action = Lock services || action = Combine configuration. Output Docker Compose File. Default: $(Build.StagingDirectory)/docker-compose.yml.
    #dockerComposeCommand: # string. Required when action = Run a Docker Compose command. Command. 
    #arguments: # string. Optional. Use when action != Lock services && action != Combine configuration && action != Write service image digests. Arguments. 
  # Advanced Options
    #dockerHostEndpoint: # string. Docker Host Service Connection. 
    #nopIfNoDockerComposeFile: false # boolean. No-op if no Docker Compose File. Default: false.
    #requireAdditionalDockerComposeFiles: false # boolean. Require Additional Docker Compose Files. Default: false.
    #currentWorkingDirectory: '$(System.DefaultWorkingDirectory)' # string. Alias: cwd. Working Directory. Default: $(System.DefaultWorkingDirectory).
    #dockerComposePath: # string. Docker Compose executable Path.

입력

containerregistrytype - Container Registry 형식
string; 필수 사항입니다. 허용되는 값: Azure Container Registry, Container Registry. 기본값은 Azure Container Registry입니다.

컨테이너 레지스트리 유형을 선택합니다.


Docker 레지스트리 서비스 연결dockerRegistryEndpoint -
string; 선택 사항입니다. containerregistrytype = Container Registry때 사용합니다.

Docker 레지스트리 서비스 연결을 선택합니다. 레지스트리를 사용하여 인증해야 하는 명령에 필요합니다.


Azure 구독
입력 별칭: azureSubscriptionEndpoint. string; 선택 사항입니다. containerregistrytype = Azure Container Registry때 사용합니다.

Azure 구독을 선택합니다.


Azure Container Registry
string; 선택 사항입니다. containerregistrytype = Azure Container Registry때 사용합니다.

Azure Container Registry를 선택합니다.


docker Compose 파일dockerComposeFile -
string; 필수 사항입니다. 기본값은 **/docker-compose.yml입니다.

사용할 기본 Docker Compose 파일의 경로입니다.


추가 Docker 작성 파일additionalDockerComposeFiles -
string;

기본 Docker Compose 파일과 결합할 추가 Docker Compose 파일입니다. 상대 경로는 기본 Docker Compose 파일이 포함된 디렉터리를 기준으로 확인됩니다. 지정된 파일을 찾을 수 없으면 무시됩니다. 새 줄에 각 파일 경로를 지정합니다.


dockerComposeFileArgs - 환경 변수
string;

명령 중에 설정할 환경 변수입니다. 각 이름=값 쌍을 새 줄에 지정합니다.


projectName - 프로젝트 이름
string; 기본값은 $(Build.Repository.Name)입니다.

이미지 및 컨테이너의 기본 이름 지정에 사용되는 프로젝트 이름입니다.


이미지 이름한정 qualifyImageNames -
boolean; 기본값은 true입니다.

달리 지정하지 않은 경우 Docker 레지스트리 서비스 연결의 호스트 이름을 사용하여 빌드된 서비스에 대한 이미지 이름을 정규화합니다.


action - 작업
string; 필수 사항입니다. 허용되는 값: Build services(서비스 이미지 빌드), Push services(푸시 서비스 이미지), Run services(서비스 이미지 실행), Run a specific service(특정 서비스 이미지 실행), Lock services(서비스 이미지 잠금), Write service image digests, Combine configuration, Run a Docker Compose command. 기본값은 Run a Docker Compose command입니다.

Docker Compose 작업을 선택합니다.


추가 이미지 태그additionalImageTags -
string; 선택 사항입니다. action = Build services || action = Push services때 사용합니다.

빌드 또는 푸시되는 Docker 이미지에 대한 추가 태그입니다.


원본 태그포함 includeSourceTags -
boolean; 선택 사항입니다. action = Build services || action = Push services때 사용합니다. 기본값은 false입니다.

Docker 이미지를 빌드하거나 푸시할 때 Git 태그를 포함합니다.


includeLatestTag - 최신 태그 포함
boolean; 선택 사항입니다. action = Build services || action = Push services때 사용합니다. 기본값은 false입니다.

Docker 이미지를 빌드하거나 푸시할 때 'latest' 태그를 포함합니다.


buildImages - 이미지 빌드
boolean; 선택 사항입니다. action = Run services때 사용합니다. 기본값은 true입니다.

서비스 컨테이너를 시작하기 전에 이미지를 빌드합니다.


serviceName - 서비스 이름
string; action = Run a specific service때 필요합니다.

실행할 특정 서비스의 이름입니다.


containerName - 컨테이너 이름
string; 선택 사항입니다. action = Run a specific service때 사용합니다.

실행할 특정 서비스 컨테이너의 이름입니다.


ports - 포트
string; 선택 사항입니다. action = Run a specific service때 사용합니다.

호스트에 게시할 특정 서비스 컨테이너의 포트입니다. 각 host-port:container-port 바인딩을 새 줄에 지정합니다.


workingDirectory - 작업 디렉터리
입력 별칭: workDir. string; 선택 사항입니다. action = Run a specific service때 사용합니다.

특정 서비스 컨테이너에 대한 작업 디렉터리입니다.


entrypoint - 진입점 재정의
string; 선택 사항입니다. action = Run a specific service때 사용합니다.

특정 서비스 컨테이너에 대한 기본 진입점을 재정의합니다.


containerCommand - 명령
string; 선택 사항입니다. action = Run a specific service때 사용합니다.

특정 서비스 컨테이너에서 실행할 명령입니다. 예를 들어 이미지에 간단한 Python Flask 웹 애플리케이션이 포함된 경우 'python app.py'를 지정하여 웹 애플리케이션을 시작할 수 있습니다.


백그라운드detached - 실행
boolean; 선택 사항입니다. action = Run services || action = Run a specific service때 사용합니다. 기본값은 true입니다.

서비스 컨테이너를 백그라운드에서 실행합니다.


컨테이너 종료abortOnContainerExit - 중단
boolean; 선택 사항입니다. action = Run services && detached == false때 사용합니다. 기본값은 true입니다.

컨테이너가 종료되면 모든 컨테이너를 중지합니다.


imageDigestComposeFile - 이미지 다이제스트 작성 파일
string; action = Write service image digests때 필요합니다. 기본값은 $(Build.StagingDirectory)/docker-compose.images.yml입니다.

각 서비스의 Docker 이미지에 대한 전체 이미지 리포지토리 다이제스트로 생성되고 채워지는 Docker Compose 파일의 경로입니다.


빌드 옵션제거 removeBuildOptions -
boolean; 선택 사항입니다. action = Lock services || action = Combine configuration때 사용합니다. 기본값은 false입니다.

출력 Docker Compose 파일에서 빌드 옵션을 제거합니다.


baseResolveDirectory - Base Resolve 디렉토리
string; 선택 사항입니다. action = Lock services || action = Combine configuration때 사용합니다.

출력 Docker Compose 파일의 상대 경로를 확인해야 하는 기본 디렉터리입니다.


outputDockerComposeFile - 출력 Docker 작성 파일
string; action = Lock services || action = Combine configuration때 필요합니다. 기본값은 $(Build.StagingDirectory)/docker-compose.yml입니다.

출력 Docker Compose 파일의 경로입니다.


dockerComposeCommand - 명령
string; action = Run a Docker Compose command때 필요합니다.

인수를 사용하여 실행하는 Docker Compose 명령입니다. 예를 들어 'rm --all'을 사용하여 중지된 모든 서비스 컨테이너를 제거합니다.


arguments - 인수
string; 선택 사항입니다. action != Lock services && action != Combine configuration && action != Write service image digests때 사용합니다.

Docker Compose 명령 옵션. 예:
빌드 명령의 경우
--pull --compress --parallel입니다.


Docker 호스트 서비스 연결dockerHostEndpoint -
string;

Docker 호스트 서비스 연결을 선택합니다. 기본값은 에이전트의 호스트입니다.


Docker Compose 파일없는 경우 nopIfNoDockerComposeFile - no-op
boolean; 기본값은 false입니다.

Docker Compose 파일이 없는 경우 이 작업을 건너뜁니다. 이는 작업이 저장소에 Docker Compose 파일의 존재 여부에 따라 선택적 동작을 제공하는 경우에 유용합니다.


requireAdditionalDockerComposeFiles - 추가 Docker 작성 파일 필요
boolean; 기본값은 false입니다.

추가 Docker Compose 파일이 없는 경우 오류를 생성합니다. 이것은 파일이 존재하지 않는 경우 파일을 무시하는 기본 동작을 재정의합니다.


currentWorkingDirectory - 작업 디렉터리
입력 별칭: cwd. string; 기본값은 $(System.DefaultWorkingDirectory)입니다.

Docker Compose 명령에 대한 작업 디렉터리입니다.


docker Compose 실행 파일 경로dockerComposePath -
string;

경로가 제공된 경우 이 docker-compose 실행 파일이 사용됩니다.


작업 제어 옵션

모든 작업에는 작업 입력 외에 제어 옵션이 있습니다. 자세한 내용은 컨트롤 옵션 및 일반적인 작업 속성참조하세요.

출력 변수

이 작업은 다운스트림 단계, 작업 및 단계에서 사용할 수 있는 다음 출력 변수정의합니다.

DockerComposeOutput
명령의 출력을 포함하는 파일의 경로입니다. 여기에는 dockerComposeRun 명령(실행용 하나, 다운용 하나), dockerPush(푸시된 각 이미지당 하나), dockerBuild(빌드 자체 및 모든 태그 명령) 및 dockerDigest(가져온 각 이미지당 하나씩)의 경우 여러 파일 경로(줄 바꿈 문자로 구분)가 포함될 수 있습니다. 다른 명령은 하나의 파일만 출력합니다.

요구 사항

요구 사항 설명
파이프라인 유형 YAML, 클래식 빌드, 클래식 릴리스
다음에서 실행 에이전트, DeploymentGroup
요구 없음
기능 이 작업은 작업의 후속 작업에 대한 요구 사항을 충족하지 않습니다.
명령 제한 어느 것이든
settable 변수 어느 것이든
에이전트 버전 지원되는 모든 에이전트 버전입니다.
작업 범주 빌드