You are viewing the documentation of TeamCity 10.x and 2017.x, which is not the most recently released version of TeamCity.
View this page in TeamCity 2018.1 documentation or refer to the listing to choose the documentation corresponding to your TeamCity version.

Skip to end of metadata
Go to start of metadata

Using this build runner, you can run any script supported by the OS.
In this section:

Command Line Runner Settings

General Settings



Working directory

Specify the Build Working Directory if it differs from the build checkout directory.


Select whether you want to run an executable with parameters or custom shell/batch scripts.

Command executable

The option is available if "Executable with parameters" is selected in the Run dropdown. Specify the executable file of the build runner

Command parameters

The option is available if "Executable with parameters" is selected in the Run dropdown. Specify parameters as a space-separated list.

Format stderr output as:
(Since TeamCity 2017.2)

Specify how the error output is handled by the runner:

  • error: any output to stderr is handled as an error
  • warning: default; any output to stderr is handled as a warning

Custom script

A platform-specific script which will be executed as a *.cmd file on Windows or as an executable script in Unix-like environments. The option is available if "Custom script" is selected in the Run dropdown.


TeamCity treats a string surrounded by percentage signs (%) in the script as a parameter reference. To prevent TeamCity from treating the text in the percentage signs as a property reference, use double percentage signs to escape them: e.g. if you want to pass "%Y%m%d%H%M%S" into the build, change it to "%%Y%%m%%d%%H%%M%%S"

Docker Settings

In this section, you can specify a Docker image which will be used to run the build step.

Run step within Docker container

Specify a Docker image here. TeamCity will start a container from the specified image and will try to run this build step within this container.  

Pull image explicitly (since TeamCity 2017.2)

If the checkbox is enabled, docker pull <imageName> will be run before the docker run command.

Additional docker run arguments

The Edit arguments field allows specifying additional options for docker run. The default argument is --rm.

Technically, the command of the build runner is wrapped in a shell script, and this script is executed inside a Docker container with the docker run command. All the details about the started process, text of the script etc. are written into the build log (the Verbose mode enables viewing them).

The checkout directory and most build agent directories are mapped inside the Docker process, and TeamCity passes most environment variables from the build agent into the docker process.

After the build step with the Docker wrapper, a build agent will run the chown command to restore access of the buildAgent user to the checkout directory. This mitigates a possible problem when the files from a Docker container are created with the 'root' ownership and cannot be removed by the build agent later. 

If the process environment contains the TEAMCITY_DOCKER_NETWORK variable, this network is passed to the started docker run command with --network switch. 

It is possible to provide extra parameters for the docker run command, for instance, provide an additional volume mapping.

Code Coverage

To learn about configuring code coverage options, refer to the Configuring Java Code Coverage page.

See also: