Search code examples
dockerteamcitywindows-server-2022

How to install docker on teamcity build agent


On my windows server 2022, I recently installed Teamcity Professional 2022.10 (build 116751) using the windows installer, and once I got it up and running I an agent through 'Install Agent' in the GUI, again using the windows installer.

I then created my first project, which I managed to do a successful build for, also running my tests. The next step was creating a docker image from this build, and pushing it to my repository. Here however, I am facing issues: my installed agent is not compatible for that build, giving me the following incompatibility error:

Incompatible runner: Docker
Unmet requirements: 
docker.version exists
docker.server.version exists

While it's clear to me that something is going wrong with the docker version, I'm not sure what exactly, or how/where to fix it. Since both the agent and the teamcity installation are running as windows services (Windows server 2022), I'm not sure if the docker version has to be installed in something running in the agent service, or simply on my windows server installation. The latter is the case: running docker info shows that it is installed.

I have tried to somehow connect to my agent, to try and install docker there, using its hostname through RDP, which does promt me for a username and password, but I have no idea which combination to use there. I have tried using the credentials of my account running the process, but none of the credentials seem to work. Nowhere in the installer did I have to pick any credentials, so I am not sure how to connect to the agent at all, or if I even can/must connect to it to install docker on it.

I found also some logging on the agent:

[2022-11-05 17:07:49,729]   INFO - rains.buildServer.AGENT.DOCKER - Failed to parse version: Docker version master-dockerproject-2022-03-26, build dd7397342a

[2022-11-05 17:07:49,729]   INFO - rains.buildServer.AGENT.DOCKER - Docker client is not available. Check whether it has been installed and PATH environment variable contains path to it.
[2022-11-05 17:07:49,777]   INFO - Server.powershell.agent.DETECT - Found through registry: PowerShell Desktop Edition v5.1.20348.1 64-bit(C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe)
[2022-11-05 17:07:49,778]   INFO - Server.powershell.agent.DETECT - Detecting PowerShell using CommandLinePowerShellDetector
[2022-11-05 17:07:50,125]   INFO - rains.buildServer.AGENT.DOCKER - Docker-compose is not available. Check whether it has been installed and PATH environment variable contains path to it.

In the parameters of my agent I can find the path parameter, which includes 'C:\Program Files\Docker;' which makes me think it is indeed the docker installation of my windows server that matters, but I then fail to see what is going wrong exactly.


Solution

  • Since the agent was installed as a service, it uses the docker version of my windows server installation. I wanted to do a reinstall of docker to see what was going wrong, and I noticed that I couldn't uninstall it through for example control panel, windows seemed to have no idea that it was installed, even though docker info would specify both a client and a server that were running.

    After hunting down all the 'hidden' docker files of the installation and reinstalling it on the host machine, these warnings went away.

    I'm still not sure if it's possible to connect to the build agent though, but since it seems to use the resources on the host machine, that seems to not be necessary anyhow.