TeamCity 构建代理:通过 URL 在服务器上注册时出错

Cam*_*ron 6 teamcity docker

我正在尝试使用 Docker 运行构建代理并将其连接到我的 TeamCity 服务器。我执行这个命令:

docker run -it -e SERVER_URL="xxxx:8111" jetbrains/teamcity-agent
Run Code Online (Sandbox Code Playgroud)

它尝试设置所有内容,但返回此错误:

[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.
Run Code Online (Sandbox Code Playgroud)

小智 6

Docker 链接是帮助我的解决方案:

--link  Add link to another container
Run Code Online (Sandbox Code Playgroud)

这不是推荐的方式,我们需要使用Ports。但这是让它运行的快速方法。

我的 teamcity docker 服务器的名称标签:teamcity-server-instance
因此,我必须将其传递给 --link 标志:

--link teamcity-server-instance
Run Code Online (Sandbox Code Playgroud)

这是我设置代理的 docker run:

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
Run Code Online (Sandbox Code Playgroud)