TeamCity 2020.2 Help


TeamCity comes with built-in Docker integration, which includes the Docker runner (formerly Docker Build) for launching Docker commands.

Supported Environments

TeamCity Docker Support can run on Windows, Linux, and macOS build agents. It uses the docker executable on the build agent machine, so it should be runnable by the build agent user.

The Docker runner supports the build, push, and tag Docker commands.

When creating TeamCity projects / build configurations from a repository URL, the runner is offered as a build step during auto-detection, provided a Dockerfile is present in the VCS repository.

Docker Command

The runner provides the following settings, depending on the selected command:





Dockerfile source

Depending on the selected source, the settings below will vary. The available options include File, a URL or File content.

Path to file

Available if File is selected as the source. Specify the path to the Docker file. The path should be relative to the checkout directory.

Context folder

Available if File is selected as the source. Specify the context for the Docker build. If blank, the enclosing folder for Dockerfile will be used.

URL to file

Available if URL is selected as the source. The URL can refer to three kinds of resources: Git repositories, pre-packaged tarball contexts, and plain text files. See the Docker documentation for details.

File Content

Available if the file cis selected as the source. You can enter the content of the Dockerfile into the field.

Image platform

Select <Any> (default), Linux or Windows.

Image name:tag

Provide a newline-separated list of image name:tag(s)

Additional arguments for the build command

Supply additional arguments to the docker build command. See Docker documentation for details.


Remove image from agent after push

If selected, TeamCity will remove the image with docker rmi at the end of the step

Image name:tag

Provide a newline-separated list of image name:tag(s)


Command name

Docker sub-command, like push or tag. For run, use Docker Wrapper

Working directory

Additional arguments for the command

Additional arguments that will be passed to the Docker command.

Running Docker via sudo

You can enforce starting Docker commands on a TeamCity agent via sudo. Add the teamcity.docker.use.sudo=true setting in the build agent configuration file or as an agent's system property. On the agent start, the TeamCity agent log will inform that the sudo prefix is used to run Docker commands.

To configure the sudoers file for the sudo command, use visudo as follows:

buildagentuser ALL=(ALL) NOPASSWD:SETENV:<full_path_to_docker>

We recommend removing (or commenting out) the Defaults requiretty line from the sudoers file to prevent the problem with docker login.

Last modified: 18 January 2021