Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to keep Airflow Variables when restarting the docker image? #636

Open
94929 opened this issue May 29, 2021 · 2 comments
Open

How to keep Airflow Variables when restarting the docker image? #636

94929 opened this issue May 29, 2021 · 2 comments

Comments

@94929
Copy link

94929 commented May 29, 2021

In Airflow UI, I created airflow variables via Admin > Variables > Create.
However, every time I restart the docker image, the airflow variables set are disappeared.
So I need to re-create all the variables I created, which is somewhat annoying.

Is there a way to keep those variables (make it non-volatile) so that I can use them even in restarting the docker image?

@foxviii
Copy link

foxviii commented Jun 5, 2021

Have you tried committing the changes to the docker image and then referencing the committed image in the yaml file?
Commit changes to a docker image: https://docs.docker.com/engine/reference/commandline/commit/
Change yaml file to point to new image - this should be referencing the newly committed image name
image

@metaver5o
Copy link

@jha929 @foxviii hi there, hopefully still in time I dealt with this issue creating a makefile which loads vars copied during build time OR added via docker cp / volumes. Vars could be loaded running make vars

  • Dockerfile:
    COPY variables.json /tmp/variables.json

  • Makefile:

vars:
	docker compose exec webserver airflow variables -i /tmp/variables.json 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants