在官方 Airflow docker-compose 中自定义 airflow.cfg

Custom airflow.cfg inside official Airflow docker-compose

我是 运行 来自 this 官方 docker 的 Airflow -compose。我想在网络应用程序中隐藏默认 DAG。通常可以在 airflow.cfg 中执行此操作,如何在 docker-compose 中隐藏默认 DAG?

干杯。

您可以使用遵循此语法 AIRFLOW__{SECTION}__{KEY}:

的环境变量来设置存在于 airflow.cfg 中的任何选项

Sets options in the Airflow configuration. This takes priority over the value in the airflow.cfg file. Replace the {SECTION} placeholder with any section and the {KEY} placeholder with any key in that specified section.

检查您从 Airflow 获得的 docker-compose.yaml 文件并将 AIRFLOW__CORE__LOAD_EXAMPLES var 的值更改为 false,如下所示:

---
version: '3'
x-airflow-common:
  &airflow-common
images.
  image: ${AIRFLOW_IMAGE_NAME:-apache/airflow:2.1.4}
  # build: .
  environment:
    &airflow-common-env
    AIRFLOW__CORE__EXECUTOR: CeleryExecutor
    AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres/airflow
    AIRFLOW__CELERY__RESULT_BACKEND: db+postgresql://airflow:airflow@postgres/airflow
    AIRFLOW__CELERY__BROKER_URL: redis://:@redis:6379/0
    AIRFLOW__CORE__FERNET_KEY: ''
    AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: 'true'
    AIRFLOW__CORE__LOAD_EXAMPLES: 'false'
    AIRFLOW__API__AUTH_BACKEND: 'airflow.api.auth.backend.basic_auth'
    _PIP_ADDITIONAL_REQUIREMENTS: ${_PIP_ADDITIONAL_REQUIREMENTS:-}
  volumes:

文档 here.