The Docker Support build feature allows automatically signing in to a Docker registry before the build start.
Adding this feature:
enables the Docker events' monitoring: such operations as
docker runwill be detected by TeamCity;
adds the Docker Info tab to the Build Results page. The tab provides information on Docker-related operations.
The feature also allows:
cleaning up the Docker images;
automatically log in to an authenticated registry before the build and log out of it after the build.
These two options require configuring a connection to a Docker registry:
Docker Images Clean-up
If you have a build configuration which publishes images, you need to remove them at some point. You can select the corresponding option and instruct TeamCity to remove the images published by a certain build when the build itself is cleaned up.
It works as follows: when an image is published, TeamCity stores the information about the registry of the images published by the build. When the server clean-up is run and it deletes the build, all the configured connections are searched for the address of this registry, and the images published by the build are cleaned up using the credentials specified in the found connection.
Docker Registry Automatic Login/Logout
If you need to log in to a registry requiring authentication before a build, select the corresponding option and a connection to Docker configured in the Project Settings. Automatic logout will be performed after the build finishes.