TeamCity 2018.1 Help

Docker Wrapper

TeamCity provides the Docker Wrapper extension for Command Line, Maven, Ant, Gradle, and since TeamCity 2018.1, .NET CLI (dotnet) and PowerShell runners. This extension allows running a build step inside the specified docker image. Each of the supported runners has the dedicated Docker settings section.

Docker Settings

In this section, you can specify a Docker image which will be used to run the build step. Once an image is specified, all the following options are available:

Setting

Description

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. Docker Wrapper

Docker image platform

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

Pull image explicitly

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 chowncommand 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 theDocker Compose variable, this network is passed to the started docker run command with --networkswitch.

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

Last modified: 20 April 2023