TeamCity代理表示它显然无法连接到服务器

时间:2018-06-17 21:22:42

标签: docker docker-compose teamcity

我试图用docker启动我自己的teamcity安装。

这是我的docker-compose文件:

version: "3.6"

networks:
  br0:

volumes:
  data:
  logs:
  db-data:
  agent-conf:

services:
  db:
    image: postgres
    restart: unless-stopped
    networks:
      - br0
    ports:
      - "5434:5432"
    volumes:      
      - db-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_USER=teamcity
      - POSTGRES_PASSWORD=${db_password}
  app:
    image: jetbrains/teamcity-server
    networks:
      - br0
    restart: unless-stopped
    volumes:
      - data:/data/teamcity_server/datadir
      - logs:/opt/teamcity/logs
    ports:
      - "8111:8111"    
  agent:
    image: jetbrains/teamcity-agent    
    networks:
      - br0
    depends_on:
      - app
    volumes:
      - "agent-conf:/data/teamcity_agent/conf"
    restart: unless-stopped
    environment:
      - SERVER_URL=${server_url}

以下是代理商的日志:

[2018-06-17 21:10:01,507]   INFO -    jetbrains.buildServer.AGENT - Build Agent version: 51228, plugins signature: NA 
[2018-06-17 21:10:01,526]   INFO - dAgentConfigurationInitializer - Loading build agent configuration from /data/teamcity_agent/conf/buildAgent.properties 
[2018-06-17 21:10:08,566]   INFO - n.AmazonInstanceMetadataReader - Amazon is not available. Amazon EC2 integration is not active: Failed to connect to http://169.254.169.254/2016-04-19. The host did not accept the connection within timeout of 7000 ms 
[2018-06-17 21:10:08,566]   INFO - .agent.AmazonPropertiesUpdater - Fetched AmazonEC2 instance metadata:  
[2018-06-17 21:10:08,568]   INFO - zon.agent.AmazonMetadataChecks - Amazon EC instance metadata contains no keys 
[2018-06-17 21:10:08,568]   WARN - .agent.AmazonPropertiesUpdater - Fetched Amazon EC2 instance metadata does not contain required values. Probably this agent was not started inside Amazon EC2. Is proxy server used? 
[2018-06-17 21:10:08,624]   INFO - .agent.impl.OsArchBitsDetector - Detecting via "getconf LONG_BIT", exit code: 0, output: 64 
[2018-06-17 21:10:08,624]   INFO - .agent.impl.OsArchBitsDetector - "teamcity.agent.os.arch.bits" detected as "64" 
[2018-06-17 21:10:08,629]   INFO -    jetbrains.buildServer.AGENT - Start build agent 
[2018-06-17 21:10:08,640]   INFO -    jetbrains.buildServer.AGENT - Agent Web server started on port 9090 
[2018-06-17 21:10:08,655]   INFO - buildServer.AGENT.registration - Registering on server via URL http://teamcity_app_1:8111: AgentDetails{Name='', AgentId=null, BuildId=null, AgentOwnAddress='null', AlternativeAddresses=[172.25.0.4], Port=9090, Version='51228', PluginsVersion='NA', AvailableRunners=[], AvailableVcs=[], AuthorizationToken='', PingCode='7GwVV0C6FMMckVqrmjUGcaPqJc1rnQTN'} 
[2018-06-17 21:10:08,677]   INFO - agent.impl.AgentPortFileWriter - Writing agent runtime file to /opt/buildagent/logs/buildAgent.xmlRpcPort 
[2018-06-17 21:10:08,677]   INFO - agent.impl.AgentPortFileWriter - Launcher version is 51228 
[2018-06-17 21:10:08,679]   INFO - agent.impl.AgentPortFileWriter - Writing agent runtime file to /opt/buildagent/logs/buildAgent.xmlRpcPort :DONE! 
[2018-06-17 21:10:08,679]   INFO -    jetbrains.buildServer.AGENT - Build agent started 
[2018-06-17 21:10:08,681]   WARN - buildServer.AGENT.registration - Error while asking server for the communication protocols via URL http://teamcity_app_1:8111/app/agents/protocols. Will try all protocols: java.net.ConnectException: Connection refused (Connection refused) (enable debug to see stacktrace) 
[2018-06-17 21:10:08,681]   INFO - buildServer.AGENT.registration - Trying to register on server using 'polling' protocol. 
[2018-06-17 21:10:08,709]   INFO - buildServer.AGENT.registration - Registration using 'polling' protocol failed: java.net.ConnectException: Connection refused (Connection refused) (enable debug to see stacktrace) 
[2018-06-17 21:10:08,710]   INFO - buildServer.AGENT.registration - Trying to register on server using 'xml-rpc' protocol. 
[2018-06-17 21:10:08,727]   INFO - buildServer.AGENT.registration - Registration using 'xml-rpc' protocol failed: java.net.ConnectException: Connection refused (Connection refused) (enable debug to see stacktrace) 
[2018-06-17 21:10:08,727]   WARN - buildServer.AGENT.registration - Error registering on the server via URL http://teamcity_app_1:8111. Will continue repeating connection attempts. 
[2018-06-17 21:10:09,153]   INFO - r.artifacts.impl.HttpDiskCache - Cleaning up items with life time in cache greater than 172800 seconds 
[2018-06-17 21:10:09,153]   INFO - r.artifacts.impl.HttpDiskCache - Finished cleaning up expired items, 0 items removed 
[2018-06-17 21:10:09,154]   INFO - dDirectoryBasedCleanupRegistry - Removing files from /opt/buildagent/temp/.old 
[2018-06-17 21:10:09,154]   INFO - dDirectoryBasedCleanupRegistry - Removing files from /opt/buildagent/work/.old 
[2018-06-17 21:10:09,218]   INFO - l.directories.DirectoryMapImpl - Cleaning up old checkout directories. Default lifetime = 192 hour(s) 

Connection refusedhttp://teamcity_app_1:8111但是当我exec进入代理容器并运行curl http://teamcity_app_1:8111时,我得到了这个:

root@c8066b07a4a3:/# curl http://teamcity_app_1:8111
Authentication required
To login manually go to "/login.html" page

因此它与服务器容器有连接。

任何人都知道我做错了什么?

0 个答案:

没有答案