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

Backend using deprecated .dockerenv-file to test if run in container #622

Open
phil-flip opened this issue Dec 7, 2023 · 0 comments
Open

Comments

@phil-flip
Copy link

I personally use Szuru on K3S in TrueNAS scale. They recently switched from Docker to another containing engine for K3S to run on. Not sure what it exactly is, but Szuru was not happy and in the process the Szuru backend kinda do the die. It was lacking the .dockerenv-file at

if os.path.exists("/.dockerenv"):

causing the code to think it is not being run in docker and try to use the Env-Vars database, data_url and data_dir, which aren't set on my Szuru serverconfig.

From what I have read online it is a common way to check, if the code is being run in Docker. But there is also not much documentation bout it. Some say it is a deprecated file which was created alongside .dockerinitfor the LXC execution driver.
A different and more future-proof way of doing it, would be to check for the env var that docker or any other containing solution sets or set your own flag with it.

The fix for now what to mount an empty .dockerenv-file at where the code above what's it to be.

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

1 participant