TeamCity-docker-compose-无法映射URL

时间:2019-04-02 08:04:09

标签: docker docker-compose teamcity

我设置了以下docker-compose文件以启动本地teamcity集群:

version: '3.1'

services:
    teamcity:
        image: jetbrains/teamcity-server:2017.1.2
        volumes:
            - teamcity-server-datadir:/data/teamcity_server/datadir
            - teamcity-server-logs:/opt/teamcity/logs
        ports:
            - 8111:8111
    teamcity-agent:
        image: jetbrains/teamcity-agent:2017.1.2
        environment:
            SERVER_URL: http://teamcity:8111
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock
        depends_on:
            - teamcity
volumes:
    teamcity-server-datadir:
    teamcity-server-logs:

如果我通过docker-compose,容器可以很好地启动,但是它不会从浏览器连接到teamcity。当我查看日志时,发现:

teamcity-agent_1  | [2019-04-02 07:56:24,623]   WARN - buildServer.AGENT.registration - Failed to obtain server supported protocols via URL http://teamcity:8111/app/agents/protocols: TeamCity Server is starting. Will try later.
teamcity-agent_1  | [2019-04-02 07:56:24,623]   WARN - buildServer.AGENT.registration - Error registering on the server via URL http://teamcity:8111. Will continue repeating connection attempts. Details: server is in a maintenance mode

我检查了一些SO帖子,但似乎没有任何解决办法,URL映射正确。我还把depends_on添加到了代理上,但是如果服务器在获取URL时遇到问题,那还是无济于事。

有什么主意吗?

1 个答案:

答案 0 :(得分:0)

好像您的teamcity代理在服务器之前启动。这是我的docker-compose,对我有用:

version: "3"

services:
  teamcity-server:
    container_name: teamcity-server
    image: jetbrains/teamcity-server:2018.2.2
    volumes:
      - ./teamcity-server/data:/data/teamcity_server/datadir
      - ./teamcity-server/logs:/opt/teamcity/logs
    ports:
      - 8111:8111

  teamcity-agent01:
    container_name: teamcity-agent01
    image: jetbrains/teamcity-agent:2018.2.2
    environment:
      - SERVER_URL=http://teamcity-server:8111
      - AGENT_NAME=teamcity-agent01
    deploy:
      resources:
        limits:
          cpus: '1.0'
          memory: 512M
        reservations:
          cpus: '0.5'
          memory: 256M