TeamCity On-Premises 2025.03 Help

Run in Docker

The Run in Docker build feature allows you to run all steps of a build configuration in the same Docker or Linux container. Below is the list of build steps that can be launched inside a container:

Steps that are not included in this list will be run outside of the specified container.

Settings

TeamCity provides two options to run build steps inside containers:

  • Run in Docker build feature — specifies global container settings common for all build steps of this configuration.

  • Container Wrapper — allows you to run one individual step in the required container.

Both "Run in Docker" and "Container Wrapper" expose identical settings.

Image name

The image name as stated in DockerHub or other registry. TeamCity will start a container from the specified image and will try to run the required build configuration within this container. For example, `ruby:2.4` will run the build configuration within the Ruby container, version 2.4.

If an agent that runs the build has Podman installed instead of Docker, use either full image names (for example, docker.io/library/alpine:latest instead of alpine:latest), or ensure the registry domain is specified in the registries.conf file on your build agent machine. See also: How to manage Linux container registries.

Image platform

Select <Any> (default), Linux, or Windows. Note that Windows images are not supported by Podman.

Force pull on each run

If enabled, the image will be pulled from the repository via docker/podman pull <imageName> before the docker/podman run command is sent.

Additional run arguments

Allows specifying additional options for the docker/podman run command. The default argument is --rm, but you can provide more. For example, add a custom volume mapping.

Kotlin DSL

The snippet below illustrates how to configure the Run in Docker feature in Kotlin DSL:

object BuildConf : BuildType({ name = "BuildConf" // ... features { runInDocker { dockerImage = "python:latest" dockerImagePlatform = RunInDockerBuildFeature.ImagePlatform.Linux dockerPull = true dockerRunParameters = "-a stdin -a stdout -i -t ubuntu /bin/bash" } } })
Last modified: 02 April 2025