Concourse CI和自定义docker-compose

时间:2017-02-24 16:31:05

标签: docker docker-compose concourse

我尝试使用自定义docker-compose

启动Concourse CI
version: '2'
services:
    concourse-web:
        image: concourse/concourse
        container_name: concourse-web
        command: web
        network_mode: host
        volumes: ["./keys/web:/concourse-keys"]
        environment:
            CONCOURSE_BASIC_AUTH_USERNAME: concourse
            CONCOURSE_BASIC_AUTH_PASSWORD: changeme
            CONCOURSE_EXTERNAL_URL: http://my.internal.ip:8092
            CONCOURSE_BIND_PORT: 8092
            CONCOURSE_POSTGRES_DATA_SOURCE: |-
                postgres://odoo:odoo@localhost:5432/concourse?sslmode=disable

    concourse-worker:
        image: concourse/concourse
        container_name: concourse-worker
        network_mode: host
        privileged: true
        command: worker
        volumes: ["./keys/worker:/concourse-keys"]
        environment:
            CONCOURSE_BIND_PORT: 8092

工作人员无法连接到Web部件。 能帮帮我吧。

P.S。数据库postgtresql在主机上的5432端口上启动,并且连接正常。

工人错误:

{"timestamp":"1487953300.400844336","source":"tsa","message":"tsa.connection.channel.forward-worker.register.failed-to-fetch-containers","log_level":2,"data":{"error":"invalid character '\u003c' looking for beginning of value","remote":"127.0.0.1:57960","session":"4.1.1.582"}}

2 个答案:

答案 0 :(得分:0)

您需要在worker上将CONCOURSE_TSA_HOST: concourse-web设置为环境变量,以便它知道要连接到哪个主机。现在它正在尝试连接到localhost上的Web部件,但这是不正确的。

您的配置的另一个问题是您尝试通过localhost连接到Postgres:CONCOURSE_POSTGRES_DATA_SOURCE: |- postgres://odoo:odoo@localhost:5432/concourse?sslmode=disable, 但是你的Postgres实例正在主机上运行。主机在docker容器内的localhost上不可用,因为docker容器拥有它自己的专用网络。它应该是:

CONCOURSE_POSTGRES_DATA_SOURCE: |- postgres://odoo:odoo@my.internal.ip:5432/concourse?sslmode=disable

答案 1 :(得分:-1)

|- postgres://odoo:odoo@localhost:5432/concourse?sslmode=disable

应删除整个前缀。替换为

CONCOURSE_POSTGRES_DATA_SOURCE: postgres://odoo:odoo@localhost:5432/concourse?sslmode=disable