dockerdocker-composeairflow

How to set my own config file in Apache Airflow


Installed Apache Airflow through docker from this manual and can't set my airflow.cfg file.

In docker-compose.yaml I found comment option that will take host configuration file and I uncommented this.

I set my host path and tried to throw airflow.cfg to config folder. But airflow still takes config from another source and does not take my config.

For example I only want to change this option: load_example=True to load_example=False

It must not show dags example. But still it does.


Solution

  • As i can see u uncomment this line

        # If you want to use it, outcomment it and replace airflow.cfg with the name of your config file
        AIRFLOW_CONFIG: '/opt/airflow/config/airflow.cfg'
      volumes:
        - ${AIRFLOW_PROJ_DIR:-.}/dags:/opt/airflow/dags
        - ${AIRFLOW_PROJ_DIR:-.}/logs:/opt/airflow/logs
        - ${AIRFLOW_PROJ_DIR:-.}/config:/opt/airflow/config
        - ${AIRFLOW_PROJ_DIR:-.}/plugins:/opt/airflow/plugins
    

    But you may need to mount this file from your local machine to inside docker in AIRFLOW_CONFIG directory or could just copy (docker cp) local airflow.cfg to this path inside the container.

    Make sure that the airflow.cfg file that u want is in the config directory of the same directory that is docker-compose.yaml

    OBS: If u want to change load_examples, you could change the variable in docker-compose file

    AIRFLOW__CORE__LOAD_EXAMPLES: 'false'