Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TeamCity Build Agent: Error registering on the server via URL

I am trying to run and connect a build agent with Docker to my TeamCity server. I execute this command:

docker run -it -e SERVER_URL="xxxx:8111" jetbrains/teamcity-agent

It tries to set everything up but returns this error:

[2019-08-12 11:02:45,218]   WARN - buildServer.AGENT.registration - 
Error while asking server for the communication prot
ocols via URL http://xxxx:8111/app/agents/protocols. Will try 
later: java.net.ConnectException: Connection timed
out: connect (enable debug to see stacktrace)
[2019-08-12 11:02:45,218]   WARN - buildServer.AGENT.registration - 
 Error registering on the server via URL http://xxxx:8111. Will continue repeating connection attempts.
like image 780
Cameron Avatar asked Aug 12 '19 17:08

Cameron


2 Answers

Docker link was the solution that helped me:

--link  Add link to another container

It's not the recommended way and we need to use Ports. But this was a quick way to get it running.

My teamcity docker server's name tag : teamcity-server-instance
So, I had to pass this to the --link flag:

--link teamcity-server-instance

This was my docker run to set up the agent:

docker run -d -e SERVER_URL="http://teamcity-server-instance:8111" --link teamcity-server-instance -v <local_volume_mount>:/data/teamcity_agent/conf jetbrains/teamcity-agent
like image 69
sunilsk1 Avatar answered Oct 13 '22 18:10

sunilsk1


Use docker network to create a bridge network for running Teamcity server and agent container. By this way you can avoid using link as well.

Create Network

sudo docker network create teamcity

Run TeamCity server

sudo docker run -u 0 -it --name teamcity-server-instance -p 8111:8111 --network teamcity jetbrains/teamcity-server

Run TeamCity Agent

sudo docker run -u 0 -it --name teamcity-agent -e SERVER_URL="http://teamcity-server-instance:8111"  --network teamcity jetbrains/teamcity-agent

It will be able to connect with the container name without any issues.

Thanks

teamcity docker

like image 40
Arun Avatar answered Oct 13 '22 17:10

Arun