Home > front end >  Custom airflow.cfg inside official Airflow docker-compose
Custom airflow.cfg inside official Airflow docker-compose

Time:10-03

I am running Airflow from this official docker-compose. I would like to hide default DAGs in the web app. Normally one can do this in airflow.cfg, how to hide default DAGs in docker-compose?

Cheers.

CodePudding user response:

You can set any option that exists in airflow.cfg by using environment variables following this syntax AIRFLOW__{SECTION}__{KEY}:

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.

Check the docker-compose.yaml file you got from Airflow and change the value of AIRFLOW__CORE__LOAD_EXAMPLES var to false, like this:

---
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:

Docs here.

  • Related