Authorizing docker for TeamCity agent under Windows 10

I have:

  • TeamCity CI
  • TeamCity agent, installed in Windows 10 as a Windows service
  • Some Java projects with integration tests, based on TestContainers framework.
  • Sonatype Nexus instance, configured as private docker registry

TestContainers based tests require docker to be available during project's build. All necessary images for the tests execution are located in Nexus. Which in turn means - in order to execute tests on CI, I should authenticate docker into Nexus in order to be able to pull them. And that's where the problem comes from.

I don't understand how should I authenticate docker for something, that is windows service (TeamCity agent).

Usually, it's done by docker login. I tried executing docker login from administrator's PowerShell on the agent's host, and it did succeeded - I am able now to pull images from administrator's console. But attempt to run the tests on the TeamCity agent fail, facing 401 Unauthorized on attempt to pull the images from Nexus. Like, the service is executed from somewhat user, for which docker login was not done.

How should I make docker authorized into private docker registry for Windows 10 TeamCity agent service?


You can set up docker authorization in Teamcity by going to Build Configuration -> Build Features -> Add Build Feature -> Docker Support -> Add Registry Connection