Compartir a través de


Docker@0 - Docker v0 task

Build, tag, push, run Docker images, or run a Docker command. Use this task with Docker or the Azure Container registry.

Inputs

containerregistrytype - Container Registry Type
string. Required. Allowed values: Azure Container Registry, Container Registry. Default value: Azure Container Registry.

Select 'Azure Container Registry' to connect to it by using an Azure Service Connection. Select 'Container registry' to connect to Docker Hub or any other private container registry.


dockerRegistryConnection - Docker Registry Connection
Input alias: dockerRegistryEndpoint. string. Optional. Use when containerregistrytype = Container Registry.

Specifies a Docker registry service connection. Required for commands that need to authenticate with a registry.


azureSubscription - Azure subscription
Input alias: azureSubscriptionEndpoint. string. Optional. Use when containerregistrytype = Azure Container Registry.

Specifies an Azure subscription.


azureContainerRegistry - Azure Container Registry
string. Optional. Use when containerregistrytype = Azure Container Registry.

Specifies an Azure Container Registry in the selected Azure Subscription. The container image is built and then pushed to this container registry.


action - Action
string. Required. Allowed values: Build an image, Tag images, Push an image, Push images, Run an image, Run a Docker command. Default value: Build an image.

Specifies a Docker action.


dockerFile - Docker File
string. Required when action = Build an image. Default value: **/Dockerfile.

Specifies the path to the Docker file. The task uses the first Docker file it finds to build the image.


buildArguments - Build Arguments
string. Optional. Use when action = Build an image.

Specifies build-time variables for the Docker file. Format each name=value pair on a new line.


defaultContext - Use Default Build Context
boolean. Optional. Use when action = Build an image. Default value: true.

Specifies the build context of the directory that contains the Docker file.


context - Build Context
string. Optional. Use when action = Build an image && defaultContext = false.

Specifies the path to the build context.


imageName - Image Name
string. Required when action == Build an image || action == Push an image || action == Run an image. Default value: $(Build.Repository.Name):$(Build.BuildId).

Specifies the name of the Docker image to build, push, or run.


imageNamesPath - Image Names Path
string. Required when action == Tag images || action == Push images.

Specifies the path to a text file that contains the names of the Docker images to tag or push. List each image name on a separate line.


qualifyImageName - Qualify Image Name
boolean. Optional. Use when action = Build an image || action = Tag images || action = Push an image || action = Push images || action = Run an image. Default value: true.

Specifies a qualify image name with the Docker registry service connection's hostname.


additionalImageTags - Additional Image Tags
string. Optional. Use when action = Build an image || action = Tag images || action = Push an image || action = Push images.

Specifies additional tags for the Docker image being built or pushed.


includeSourceTags - Include Source Tags
boolean. Optional. Use when action = Build an image || action = Tag image || action = Push an image || action = Push images. Default value: false.

Specifies whether to include Git tags when building or pushing the Docker image.


includeLatestTag - Include Latest Tag
boolean. Optional. Use when action = Build an image || action = Push an image || action = Push images. Default value: false.

Specifies whether to include the latest tag when building or pushing the Docker image.


imageDigestFile - Image Digest File
string. Optional. Use when action = Push an image || action = Push images.

Specifies the path to a file that is created and populated with the full image repository digest of the Docker image that was pushed.


containerName - Container Name
string. Optional. Use when action = Run an image.

Specifies the name of the Docker container to run.


ports - Ports
string. Optional. Use when action = Run an image.

Specifies ports in the Docker container to publish to the host. List each host-port:container-port binding on a new line.


volumes - Volumes
string. Optional. Use when action = Run an image.

Specifies the volumes to mount from the host. List each host-dir:container-dir on a new line.


envVars - Environment Variables
string. Optional. Use when action = Run an image.

Specifies environment variables for the Docker container. List each name=value pair on a new line.


workDir - Working Directory
string. Optional. Use when action = Run an image.

Specifies the working directory for the Docker container.


entrypoint - Entrypoint Override
string. Optional. Use when action = Run an image.

Specifies an override of the default entry point for the Docker container.


containerCommand - Command
string. Optional. Use when action = Run an image.

Specifies a Docker run command. The docker run command first creates a writeable container layer over the specified image, and then starts it by using the specified run command. For example, if the image contains a simple Python Flask web application you can specify python app.py to launch the web application.


detached - Run In Background
boolean. Optional. Use when action = Run an image. Default value: true.

Specifies whether to run the Docker container in the background.


restartPolicy - Restart Policy
string. Required when action = Run an image && detached = true. Allowed values: no, onFailure (On failure), always, unlessStopped (Unless stopped). Default value: no.

Specifies a restart policy.


restartMaxRetries - Maximum Restart Retries
string. Optional. Use when action = Run an image && detached = true && restartPolicy = onFailure.

Specifies the maximum number of restart retries that the Docker daemon attempts.


customCommand - Command
string. Required when action = Run a Docker command.

Specifies the Docker command and arguments to execute. For example, rmi -f image-name removes an image.


dockerHostEndpoint - Docker Host Connection
string.

Specifies a Docker host service connection. Defaults to the agent's host.


enforceDockerNamingConvention - Force image name to follow Docker naming convention
boolean. Default value: true.

If enabled, modifies the Docker image name according to Docker naming conventions. For example, convert upper case characters to lower case and remove spaces.


workingDirectory - Working Directory
Input alias: cwd. string. Default value: $(System.DefaultWorkingDirectory).

Specifies the working directory for the Docker command.


memory - Memory limit
string.

Specifies the maximum amount of memory available to the container as a integer with optional suffixes, for example 2GB.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version All supported agent versions.
Task category Build