Replies: 4 comments 4 replies
-
Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval. |
Beta Was this translation helpful? Give feedback.
-
That is something with your setup and race condition with your gosu. You should start your containers with the right user not with root - that is something you should investigate on your side to see what happens when you gosu. There might be many reasons for that - it also depends on what image you have, what entrypoint you use and whether this entrypoint properly propagest signals and serves as "init" process. |
Beta Was this translation helpful? Give feedback.
-
My recommendation: use the reference image as a base understand how entrypoints work https://airflow.apache.org/docs/docker-stack/entrypoint.html and do not use gosu to change the user just USER setting in the image as we do in the reference image. |
Beta Was this translation helpful? Give feedback.
-
Thanks for you replies! The reason I use this approach is to have regular security-upgrades installed into all airflow containers. In my understanding the modification of the entrypoint utilizing gosu should not impact the original entrypoint, here are my exact changes: Dockerfile FROM apache/airflow:slim-2.10.5-python3.11
# UID 1000 necessary for logs directory permission
RUN usermod -u 1000 airflow
# root permission necessary to start cronjob
USER root
# install and configure cron and unattended-upgrade to install daily security upgrades
# ...
# cat <<EOF > /etc/apt/apt.conf.d/50unattended-upgrades
# Unattended-Upgrade::Origins-Pattern {
# "origin=Debian,codename=\${distro_codename},label=Debian-Security";
# "origin=Debian,codename=\${distro_codename}-security,label=Debian-Security";
# };
# EOF
# echo "0 2 * * * unattended-upgrade" > /etc/cron.d/security-upgrade
# using dump-init as described in the docs
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/usr/local/bin/docker-entrypoint.sh"] /usr/local/bin/docker-entrypoint.sh #!/bin/sh
service cron start
exec gosu airflow /entrypoint "$@" The container is not restarted, therefore all processes should be run as I can not set the
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Apache Airflow version
2.10.5
If "Other Airflow 2 version" selected, which one?
No response
What happened?
Every night at 00:00 a new directory is created in
/opt/airflow/logs/scheduler/
once in a while this directory is owned by root instead of the airflow user inside the docker container. This leads to an empty Dag list on the webserver and airflow not working at all.airflow-scheduler docker log shows many of:
What you think should happen instead?
The daily directory should be created always with the same ownership and in case of a wrong permissions I would still expect airflow to show dags on the webserver, but stop scheduling new tasks (at the end only the scheduler is affected, right?).
How to reproduce
It is hard to reproduce since this happens only once in while, maybe every two weeks. It feels like a race condition or some other timing issue.
Operating System
Debian GNU/Linux 12 (bookworm) | Docker version 28.0.4, build b8034c0
Versions of Apache Airflow Providers
No response
Deployment
Docker-Compose
Deployment details
I use docker compose environment. For unattended-upgrades I start the container as root user and use
gosu
in my entrypoint to set the correct user with:exec gosu airflow /entrypoint "$@"
. In the airflow Image I set the airflow UID to 1000 withRUN usermod -u 1000 airflow
. The logs directory is locally mounted withAnything else?
No response
Are you willing to submit PR?
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions