Some JavaScript to find out if your App (i.e. Express.js) is
- running inside a docker container
- running under the
root
user
Sources and inspirations:
- https://forums.docker.com/t/root-user-or-non-root-user-inside-container/966
- https://docs.docker.com/engine/reference/builder/#user
- https://stackoverflow.com/questions/24549746/switching-users-inside-docker-image-to-a-non-root-user
- https://stackoverflow.com/questions/20010199/how-to-determine-if-a-process-runs-inside-lxc-docker
- https://www.npmjs.com/package/is-docker
- https://github.com/sindresorhus/is-docker