2017-09-02 42 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