I’m sure if you’ve used MongoDB, you are probably aware of the warnings upon startup telling you to run as a non-root user and to disable Transparent Huge Pages.
I’ve scoured the internet and have spent a good bit of time trying to remedy both of these things in my Docker container. However, nothing seems to work. The THP settings don’t seem to stick (still get warnings at startup) and I cannot run as a different user with sudo access. Mongo creates the user “mongodb” with the appropriate permissions on install, I’ve verified the user exists, yet the process is still owned by root. If I change to another user before my entrypoint, I receive a “no tty present” error.
This is on Ubuntu. I had begun to move to Alpine (as i have with my other images) but apparently Alpine’s package dependencies for mongo are screwed up (when i tried earlier this week at least).
Any help or relevant documentation on how to run MongoDB as a non-root user while disabling THP inside a Docker Container would be vastly appreciated!
*edit: I realize now that THP is a kernel level setting and therefore is not something that can be set within a container