【发布时间】:2020-04-30 08:46:56
【问题描述】:
基本上,我想构建 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 中的数据库也已创建。有谁知道如何解决这个问题?
【问题讨论】:
-
我不清楚你为什么需要 initdb 部分? puckel docker 将在启动时运行 initdb。此外,您没有在发布的 sn-p 中包含气流部分。 initdb 好像没有正常运行,查看启动气流的日志
-
因为我需要为以下过程初始化一些参数。我以前考得很好。 postgres 和 initdb 都运行成功。我会尽快附上日志
-
我会让气流图像运行 initdb 部分。气流的大多数参数都可以使用环境变量进行配置。
-
感谢您的意见。也许我会试一试。但现在我认为问题不在 initdb 上。
标签: postgresql docker-compose airflow