#3937·choco

Push Docker images to an internal registry on every build of a long-lived branch

Author: gep13Created Sep 18, 2026Updated Sep 18, 2026
Labels2 - WorkingBuild AutomationNO RELEASE NOTES

Is Your Feature Request Related To A Problem? Please describe.

The Chocolatey CLI Docker images are only built when a tag is pushed, and only pushed to Docker Hub. Both TeamCity Docker build configurations (Windows and Linux) are triggered only by tags/*, and the Linux "Create Docker Manifest" step only runs on tags.

This means the images are built for the first time during a release. When docker build has failed, or the pushed image hasn't worked, we've found out on release day, after the image was already public on Docker Hub.

Describe The Solution. Why is it needed?

Build and push the Docker images to an internal registry on every build of develop, master, release/*, hotfix/* and support/*, as well as on tags, so they can be tested before a release. Publishing to Docker Hub becomes a separate promotion step.

This uses the internal registry support being added to Chocolatey.Cake.Recipe (see Related Issues). The changes to .teamcity/settings.kts are:

  • In both Docker build configurations, replace the env.DOCKER_USER / env.DOCKER_PASSWORD parameters with env.DOCKER_INTERNAL_USER / env.DOCKER_INTERNAL_PASSWORD.
  • Pass --dockerInternalRegistry and --dockerImageVersion=%env.CHOCOLATEY_VERSION% to every Cake call that builds, pushes, or creates a manifest, so that the Windows and Linux images and the manifest all use the parent Chocolatey build's version.
  • Widen the finish-build trigger filters from +:tags/* to also include develop, master, release/*, hotfix/* and support/*.
  • Remove the tags-only condition on the Linux "Create Docker Manifest" step, and change its credential conditions to the internal variables.
  • Update the recipe version in recipe.cake once the recipe with this support is released.

The registry host and credentials are referenced only by TeamCity parameter name, so no internal hostname is committed to the repository.

Additional Context

Before the configuration change is merged, these TeamCity parameters must exist, or the Docker builds will fail to start because they reference undefined parameters:

  • system.InternalDockerRegistry
  • system.InternalDockerUsername
  • system.InternalDockerPassword

The build agents that run the Docker builds need network access to the registry, and must trust its certificate.

The existing Docker Hub credential parameters are left in TeamCity, because the promotion step will need them.

The main Chocolatey build's trigger excludes master and support/*, so builds of those branches will only produce Docker images when the main build is run by hand.

Related Issues