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.
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
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?
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.
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:/opt/airflow/airflow.cfg
I have my config file in a folder called config where the docker-compose.yml file is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With