DockerCompose@1 - Docker Compose v1 任务

生成、推送或运行多容器 Docker 应用程序。 任务可与 Docker 或 Azure 容器注册表一起使用。

语法

# 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 - 容器注册表类型
string。 必填。 允许的值:Azure Container RegistryContainer Registry。 默认值:Azure Container Registry

选择 Container Registry Type(容器注册表类型)。


dockerRegistryEndpoint - Docker 注册表服务连接
string。 可选。 当 containerregistrytype = Container Registry时使用。

选择 Docker 注册表服务连接。 需要使用注册表进行身份验证的命令。


azureSubscription - Azure 订阅
输入别名azureSubscriptionEndpoint. string。 可选。 当 containerregistrytype = Azure Container Registry时使用。

选择 Azure 订阅。


azureContainerRegistry - Azure 容器注册表
string。 可选。 当 containerregistrytype = Azure Container Registry时使用。

选择 Azure 容器注册表。


dockerComposeFile - Docker Compose 文件
string。 必填。 默认值:**/docker-compose.yml

要使用的主 Docker Compose 文件的路径。


additionalDockerComposeFiles - 其他 Docker Compose 文件
string

要与主 Docker Compose 文件合并的其他 Docker Compose 文件。 相对于包含主 Docker Compose 文件的目录解析相对路径。 如果未找到指定的文件,则忽略该文件。 在新行上指定每个文件路径。


dockerComposeFileArgs - 环境变量
string

要在命令期间设置的环境变量。 在新行上指定每个 name=value 对。


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 digestsCombine configurationRun 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 - 服务名称
stringaction = 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 Web 应用程序,您可以指定“python app.py”来启动 Web 应用程序。


在后台中运行 detached -
boolean。 可选。 当 action = Run services || action = Run a specific service时使用。 默认值:true

在后台运行服务容器。


容器退出abortOnContainerExit - 中止
boolean。 可选。 当 action = Run services && detached == false时使用。 默认值:true

当任何容器退出时停止所有容器。


imageDigestComposeFile - 图像摘要撰写文件
stringaction = Write service image digests时是必需的。 默认值:$(Build.StagingDirectory)/docker-compose.images.yml

Docker Compose 文件的路径,该文件创建并填充了每个服务的 Docker 映像的完整映像存储库摘要。


removeBuildOptions - 删除生成选项
boolean。 可选。 当 action = Lock services || action = Combine configuration时使用。 默认值:false

从输出 Docker Compose 文件中删除构建选项。


baseResolveDirectory - 基解析目录
string。 可选。 当 action = Lock services || action = Combine configuration时使用。

应从中解析输出 Docker Compose 文件中的相对路径的基目录。


outputDockerComposeFile - 输出 Docker Compose 文件
stringaction = Lock services || action = Combine configuration时是必需的。 默认值:$(Build.StagingDirectory)/docker-compose.yml

输出 Docker Compose 文件的路径。


dockerComposeCommand - 命令
stringaction = Run a Docker Compose command时是必需的。

Docker Compose 命令执行。 例如,'rm --all' 可删除所有已停止的服务容器。


arguments - 参数
string。 可选。 当 action != Lock services && action != Combine configuration && action != Write service image digests时使用。

Docker Compose 命令选项。 例如:
对于 build 命令,
--pull --compress --parallel 来。


dockerHostEndpoint - Docker 托管服务连接
string

选择 Docker 主机服务连接。 默认为代理的主机。


如果没有 Docker Compose 文件,则 nopIfNoDockerComposeFile - 无作
boolean。 默认值:false

如果 Docker Compose 文件不存在,请跳过此任务。 当任务根据存储库中是否存在 Docker Compose 文件提供可选行为时,这非常有用。


requireAdditionalDockerComposeFiles - 需要其他 Docker Compose 文件
boolean。 默认值:false

如果其他 Docker Compose 文件不存在,则生成错误。 这将覆盖默认行为,即忽略不存在的文件。


currentWorkingDirectory - 工作目录
输入别名cwd. string。 默认值:$(System.DefaultWorkingDirectory)

Docker Compose 命令的工作目录。


dockerComposePath - Docker Compose 可执行路径
string

如果提供了路径,则将使用此 docker-compose 可执行文件。


任务控制选项

除任务输入之外,所有任务都具有控制选项。 有关详细信息,请参阅 控件选项和常见任务属性

输出变量

此任务定义了以下 输出变量,可以在下游步骤、作业和阶段中使用这些变量。

DockerComposeOutput
包含命令输出的文件的路径。 对于 dockerComposeRun 命令(一个用于运行,一个用于关闭)、dockerPush(一个用于推送的每个映像)、dockerBuild(构建本身和所有标记命令)和 dockerDigest(一个用于每个提取的映像),这可以包含多个文件路径(以换行符分隔)。 其他命令仅输出一个文件。

要求

要求 DESCRIPTION
管道类型 YAML,经典版本,经典版本
运行时间 代理,DeploymentGroup
需求 没有
功能 此任务不满足作业中后续任务的任何要求。
命令限制 任意
Settable 变量 任意
代理版本 所有支持的代理版本。
任务类别 建造