docker - 损坏的 DAG:[/usr/local/airflow/dags/test.py] 没有名为“boto3”的模块。如何将 pip 安装到气流容器中?
问题描述
我有以下层次结构:
-airflow
-dags
-test.py
-deployment
-dockerfile
-docker compose
-scripts
-requirements.txt
该test.py
文件使用scripts
目录中的函数。一些脚本具有外部导入语句,例如import boto3
. 我认为这就是问题所在,因为当我运行气流网络服务器时,我可以看到所有不需要这些外部包的 DAG 都已加载,但确实需要它们的 DAG 无法加载:
Broken DAG: [/usr/local/airflow/dags/test.py] No module named 'boto3'
文件docker compose
看起来有些东西像这样:
version: '3'
services:
webserver:
build: .
我试图将这样的东西添加到我的dockerfile
:
FROM puckel/docker-airflow:1.10.9
WORKDIR /airflow
COPY requirements.txt /airflow
RUN pip install -U pip && pip install -r requirements.txt
但是这些软件包似乎没有安装。requirements.txt
每当我启动网络服务器(docker compose up)时,如何安装我的?
解决方案
可以像...一样简单
WORKDIR /airflow
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
您可能还需要指导 Docker 构建步骤。我认为docker-compose build .
或者docker-compose up --no-cache
......但这是基于松散的记忆
推荐阅读
- botframework - Microsoft Bot 调用 Bot 或编排多个 Bot
- java - 为什么类型擦除不适用于 Java 中的数组?
- javascript - 构建社交网络 JavaScript、Bootstrap、JQuery、PHP 和 Mysqil
- configuration - Hazelcast:在 ReplicatedMap 上设置最大大小、驱逐策略
- angularjs - 如何验证用户是否在 Kendo UI 自动完成小部件上进行了选择?
- epplus - EPPlus 4.5.2.1 NuGet 包损坏
- apache-spark - 列变换后的 Pyspark 随机森林特征重要性映射
- xamarin.forms - F# 中的 DependencyAttribute 类
- python-3.6 - 你如何让 Discord 机器人读取发送给它的 DM?(discord.py)
- flowtype - 有没有人有一个真正的使用流类型的网络项目?