气流如何在docker容器中安装airflow.cfg [英] Airflow how to mount airflow.cfg in docker container

查看:54
本文介绍了气流如何在docker容器中安装airflow.cfg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 docker 容器中运行气流,并且想要将我的 airflow.cfg 挂载为一个卷,以便我可以快速编辑配置,而无需重建我的图像或直接在正在运行的容器中进行编辑.我能够将我的 airflow.cfg 安装为一个卷,并且我的气流网络服务器在启动时成功地从中读取了配置.但是,当我在主机上编辑时,更改不会反映在 docker 容器内.

I'm running airflow in a docker container and want to mount my airflow.cfg as a volume so I can quickly edit the configuration without rebuilding my image or editing directly in the running container. I'm able to mount my airflow.cfg as a volume and my airflow webserver successfully reads the configuration from it on start up. However, when I edit on the host changes aren't reflected inside the docker container.

docker 容器内 findmnt -Mairflow.cfg 的输出返回:

The output for findmnt -M airflow.cfg inside the docker container returns:

TARGET                         SOURCE                                                             FSTYPE OPTIONS
/usr/local/airflow/airflow.cfg /dev/sda1[/host/path/airflow/airflow.cfg~//deleted]  ext4   rw,relatim

从该输出看来,airflow.cfg 继续指向 airflow.cfg 的原始未编辑版本.是否有任何解决方法允许从主机更新配置文件?

From that output it seems like airflow.cfg continues to point to the original unedited version of airflow.cfg. Is there any workaround to allow updating the config file from the host machine?

我使用 puckel github repo 中的 LocalExecutor 撰写文件作为基础.我修改它以在撰写文件中挂载 airflow.cfg 而不是将其复制到 Dockerfile 中.

I'm using the LocalExecutor compose file from the puckel github repo as a base. I modify it to mount airflow.cfg in the compose file instead of copying it in the Dockerfile.

推荐答案

我遇到了同样的问题,我通过在 webserver 服务下的 docker-compose.yml 中添加以下行来解决它

I had the same issue and I solved it by adding the following line to docker-compose.yml, under the webserver service

- volumes:
  - ./config/airflow.cfg:/usr/local/airflow/airflow.cfg

我的配置文件位于一个名为 config 的文件夹中,其中 docker-compose.yml 文件所在.

I have my config file in a folder called config where the docker-compose.yml file is.

这篇关于气流如何在docker容器中安装airflow.cfg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆