docker.server.version doesnt exist for official agent image 2020.1
Answered
I just updated my TeamCity server to 2020.1, and thought i would also update the agents to 2020.1. However, build steps that run in a docker container are now saying there are no compatible agents with `Unmet requirements: docker.server.version exists`.
Going back to the 2019.2.4 version fixes the problem, and looking at the agent description in TC shows that indeed there is no value for `docker.server.version` in the 2020.1 version.
Did something change with the image?
Please sign in to leave a comment.
Hey - from TeamCity UI you can click Agents tab, then select your agent, then there's an Agent Logs tab. I'd say in teamcity-agent.log there'd be something logged.
This is what i found:
docker-support is included in the "plugin initialization completed" list and appears to have been successfully downloaded from the server.
Hi Francesco,
when an agent starts, teamcity checks connection to the docker service and pulls some information from it. The error you see means that either the service was not running yet, or that the user running the agent process does not have permissions to connect to it.
The most common causes for this are that the full server is restarting and the docker service starts after the build agent is already up, and that the initial setup by docker did not set the service in a way that the agent can communicate with it (typically set under admin/root accounts while teamcity's build agent does not have permissions for it)
That makes sense, but this works perfectly fine in the older version of teamcity, with identical setup. Also, it is running in mesos as a docker image, so docker is inherently already running.
Did something change with how teamcity connects to the local docker daemon?
Hi Francesco,
the only changes that have happened recently to the connection to docker services is that the default docker images do not run the process as root any longer, and as such, they don't have permission to connect to the docker daemon. This was already the case before for local docker installations and was a docker issue, not strictly related to teamcity (https://docs.docker.com/engine/install/linux-postinstall/), but if you are using the official images you might be newly impacted by it. More info here: https://www.jetbrains.com/help/teamcity/2020.1/upgrade-notes.html#UpgradeNotes-AgentDockerimagesrunundernon-rootuser
Can you check that?
I have the same problem after upgrading. Agent works in docker, image jetbrains/teamcity-agent. Before upgrading everything was fine.
One of the agent runs like this:
Removing or adding "--privileged -e DOCKER_IN_DOCKER=start \" line does not affect.
Running `docker info` in agent container by user buildagent user (default user in jetbrains/teamcity-agent) causes an error:
Running by root inside the container works fine.
One more detail:
I found a resolution for my case. Docker GID (group ID) in the host system is 1001, meanwhile, docker GID in the container is 999.
Host system:
Agent container:
I just add this line in docker run script:
which becomes
After this, docker works for buildagent user inside docker.
I found it working with the the linux-sudo agent not latest and --priviledge on the command line:
docker run -it -e SERVER_URL="<URL>" -e DOCKER_IN_DOCKER=start --name tc_docker_agent --privileged -e AGENT_NAME=docker_test jetbrains/teamcity-agent:2020.1.5-linux-sudo
Lusena Cd thanks, that worked for me.
Same for me with different versions of agent. My current docker-compose:
If I log in to the agent, docker info works fine only with sudo, but not unprivileged:
ERROR: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/info: dial unix /var/run/docker.sock: connect: permission denied
UID and GID in container are the same as on the host. Host OS is docker, and docker on host works fine without root privileges.
Any idea what's wrong?