Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What server URL should one provide for TeamCity agent in Docker?

The problem. I am trying to create a TeamCity infrastructure (a server and an agent) on Ubuntu Linux 16.04.1 LTS using Docker. I have run a Docker container with jetbrains/teamcity-server image as described on this page. It is possible to access the TeamCity server via web browser using the IP address of the server and port 8111.

Now I try to run a Docker container with an agent as described on this page. It is written: Note that "localhost" will not generally not work as that will refer to the "localhost" inside the container. Well, when I supply "http://localhost:8111", or "http://127.0.0.1:8111", or "http://my_server_ip:8111" to the running script for the agent container I finally get 1) "WARN - buildServer.AGENT.registration - Error registering on the server via URL http://localhost:8111 (sic! always localhost). Will continue repeating connection attempts.", or 2) "WARN - buildServer.AGENT.registration - Error while asking server for the communication protocols via URL http://localhost:8111/app/agents/protocols."

Also I have tried to reveal the IP address of the Docker container running the server and supply it for the agent running script. But the result was the same.

Question. What server URL I should provide? Are there any implicit steps in the TeamCity configuration with Docker which I miss?

like image 382
Hoborg Avatar asked Jan 29 '17 08:01

Hoborg


People also ask

How do I link my TeamCity agent?

Installing via Windows installerIn the TeamCity web UI, navigate to the Agents tab. Click the Install Build Agents link and select Windows Installer to download the installer. On the agent, run the agentInstaller.exe Windows Installer and follow the installation instructions.

Does TeamCity use Docker?

TeamCity Docker Support can run on Windows, Linux, and macOS build agents. It uses the docker executable on the build agent machine, so it should be runnable by the build agent user.


1 Answers

You can use the --link parameter to link containers:

  1. Start your jetbrains/teamcity-server and use --name teamcity-server to give it a descriptive name
  2. Start the agent container and use --link teamcity-server to enable connectivity to the teamcity-server container
  3. Inside of your agent container you can now use teamcity-server as the hostname to connect to the teamcity-server container

Please also check out Docker container networking which superseded the --link feature.

like image 162
Sebastian Avatar answered Oct 09 '22 22:10

Sebastian