基于postgres的气流Web服务器上的错误

时间:2020-04-30 08:46:56

标签: postgresql docker-compose airflow

基本上,我想构建docker-airflow:

我的Dockerfile如下:

FROM puckel/docker-airflow:1.10.6
COPY ./airflow_home/airflow.cfg /usr/local/airflow/airflow.cfg
...

我有类似docker-compose.yml的

version: "3.4"
services:
    postgres:
        image: "postgres:9.6"
        container_name: "postgres"
        environment:
            - POSTGRES_USER=airflow
            - POSTGRES_PASSWORD=airflow
            - POSTGRES_DB=airflow
        ports:
            - "5432:5432"
        volumes:
            - './data/postgres:/var/lib/postgresql/data'
    # comment initdb after you will have use it at first run
    # set the client and processed log types here
    initdb:
        build: .
        entrypoint: airflow initdb
        entrypoint:
            ['python3', '/usr/local/airflow/__init__.py', '-C', '$Client', '-T', '$Types']
        volumes:
            - './airflow_home/packages:/usr/local/airflow/packages'
        depends_on:
            - postgres

requirements.txt中没有其他气流库。

执行操作时总是会出现错误:

docker-compose up webserver

错误是:

sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "connection" does not exist
webserver_1  | LINE 2: FROM connection GROUP BY connection.conn_id

“ xxx”还包括日志

我本来以为错误将来自不同的版本。但我确保版本已正确确认。我使用了来自同一版本的airflow.cfg,并使用Postgres修改了sql_connection。 Postgres中的数据库也已创建。有谁知道该如何解决?

1 个答案:

答案 0 :(得分:0)

我找到了原因。 因为我在 initdb 部分中使用了两个入口点。它将覆盖docker内部的原始初始化脚本。当我删除入口点时:

['python3', '/usr/local/airflow/__init__.py', '-C', '$Client', '-T', '$Types']

现在可以使用。