python - Airflow 2/docker-compose : how to install Python dependencies for DAGs?

标签 python docker-compose dependencies airflow

我已经使用 docker-compose 安装了 airflow 2.0.2,如 https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html 中所述.

我已经研究了很长时间,但我没有找到为我的 DAG 安装 python 依赖项的方法。我知道如何使用 Dockerfile (COPY requirements.txt/app/RUN pip install -r requirements.txt) 执行此操作,但此处不涉及 Dockerfile。

  • 如何在 airflow 2.0.2/docker-compose 中安装 python 依赖项?
  • 我需要在使用自定义 docker-compose 部署的六个容器中的哪个上安装依赖项?

最佳答案

而不是使用

image: apache/airflow:x.x.x

在你的 docker compose 中,你想将其设置为

build:
    context: .
    dockerfile: Dockerfile

然后将其写入您的 Dockerfile

FROM apache/airflow:x.x.x

COPY requirements.txt ./requirements.txt

您的 requirements.txt 包含 python 包。所以你没有使用图像,而是通过安装 python 包再次构建它。

关于python - Airflow 2/docker-compose : how to install Python dependencies for DAGs?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67486845/

相关文章:

gradle - 如何从 gradle 中的 jar 中排除特定类

python - Win7以上使用Python关闭Chrome浏览器

python - HBase-HappyBase : Socket Timeout Error For Larger Files - Works Good With Smaller one's

python - 从字节文件中查找拜耳模式格式

docker - Portainer 是否有可能从运行的容器创建 docker-compose yml 文件?

windows - 无法显示来自 Windows 容器 : Windows 2019 Server 的 GUI 应用程序

Golang 找不到模块提供包 {PACKAGE_NAME} : working directory is not part of a module

python - ModuleNotFoundError : No module named 'django.utils.six'

mysql - docker 撰写 spring boot 日志

c++ - 有效的 C++ "35. Minimize compilation dependencies between files"。今天还有效吗?