2017-09-02 43 views
0

我有以下docker-compose.yml文件,其中包含一个Team City Server和Agent,我想在使用Docker 17.06.1-ce的本地Win 10开发机器上运行-win24(13025):Docker用团队城市代理编写DNS问题

version: '3.1' 

services: 
    tc_server: 
    image: jetbrains/teamcity-server:2017.1.2 
    ports: 
     - 8111:8111 
    volumes: 
     - teamcity_server:/data/teamcity_server/datadir 
     - teamcity_server_logs:/opt/teamcity/logs 
    tc_agent: 
    image: jetbrains/teamcity-agent:2017.1.2 
    volumes: 
     - /var/run/docker.sock:/var/run/docker.sock 
     - teamcity_agent_conf:/data/teamcity_agent/conf 
    environment: 
     SERVER_URL: http://tc_server:8111 
volumes: 
    teamcity_server: 
    teamcity_server_logs: 
    teamcity_agent_conf: 

Team City Server和Agent启动,但在用户界面中看不到任何未经授权的代理。

我查了搬运工日志:

tc_agent_1 | [2017-09-02 10:47:27,548] WARN - buildServer.AGENT.registration - Error while asking server for the communication protocols via URL http://tc_server:8111/app/agents/protocols. Will try all protocols: java.net.ConnectException: Connection refused Connection refused) (enable debug to see stacktrace) 
tc_agent_1 | [2017-09-02 10:47:27,549] INFO - buildServer.AGENT.registration - Trying to register on server using 'polling' protocol. 
tc_agent_1 | [2017-09-02 10:47:27,570] INFO - buildServer.AGENT.registration - Registration using 'polling' protocol failed: java.net.ConnectException: Connection refused (Connection refused) (enable debug to see stacktrace) 
tc_agent_1 | [2017-09-02 10:47:27,570] INFO - buildServer.AGENT.registration - Trying to register on server using 'xml-rpc' protocol. 
tc_agent_1 | [2017-09-02 10:47:27,581] INFO - buildServer.AGENT.registration - Registration using 'xml-rpc' protocol failed: java.net.ConnectException: Connection refused (Connection refused) (enable debug to see stacktrace) 
tc_agent_1 | [2017-09-02 10:47:27,581] WARN - buildServer.AGENT.registration - Error registering on the server via URL http://tc_server:8111. Will continue repeating connection attempts. 

它看起来像代理无法连接到服务器,但在运行此命令显示剂容器可以解决,并从TC服务器容器检索(矛盾日志警告):

docker-compose exec tc_agent curl http://tc_server:8111/app/agents/protocols 
<list><string>polling</string></list> 

我试图从码头工人,compose.yml文件中删除了代理,并且跨越它,分别使用多克(tc_default是,容器所使用的网络):

docker run --rm --network tc_default -e SERVER_URL=http://tc_server:8111 jetbrains/teamcity-agent:2017.1.2 

这给出了以前在日志中发现的相同错误。于是我使出使用服务器的IP地址:

docker run --rm --network tc_default -e SERVER_URL=http://172.18.0.3:8111 jetbrains/teamcity-agent:2017.1.2 

这个工作,代理出现在球队阵容城市未授权的代理列表。

这是代理的DNS问题还是我错误地使用docker-compose网络?如果可能的话,我宁愿将服务器和代理保存在一个单一的Docker-compose文件中。

+1

从您的服务名工作尝试删除'_',看看有没有什么帮助。所以重命名'tc_server'为'tcserver' –

+0

@TarunLalwani就是这样!主机名中的下划线无效,因此DNS查找失败。我改变了它,像你建议和第一次工作。谢谢 :) – stevewarduk

回答

1

取出_形成你的服务的名称,它应该工作。我最近在使用http://service_name:port时无法看到Python中的问题。但是,使用http://servername:port在许多图书馆和地方工作

虽然_,它仍然不适合所有

0

您的tc_server需要在代理之前启动。添加tc_agent服务里面配置以下,以确保启动顺序:

depends_on: 
     - tc_server