Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Container autodetect fails when not running in docker #2143
Passenger looks for existing of .dockerenv file to check if running in container:
Not all containers are docker, we have LXC/LXD here and this check will fail on it. You should use multiple checks, like environment variable container (see https://stackoverflow.com/questions/20010199/how-to-determine-if-a-process-runs-inside-lxc-docker/20010626#20010626) to determinate if passenger is running inside container.
Steps to reproduce:
I agree that the existing check is definitely too docker specific. Being somewhat less familiar with LXC/LXD I wonder if you could confirm some things for me.
Do LXC/LXD containers prevent modifying the OOM score of processes in the container?
OOM score cannot be adjusted if unprivileged container. it is hard kernel limitation - unprivileged container cannot set higher than current value to prevent users start unkillable processes (unprivileged containers can be started by normal users).
I don't know if container envvar is official way to detect, but it works. Content of