How to run an nginx container as non root?
Use the rootless docker-imager from nginx.
Image
nginxinc/nginx-unprivileged
DockerHub
https://hub.docker.com/r/nginxinc/nginx-unprivileged
You can remove (or comment) the user
directive at the top of your nginx.conf
file.
This directive is relevant when you run nginx as root
. It defines the user possessing the pid of your nginx subprocesses.
When you don't run nginx as root
this directive is irrelevant, your nginx subprocesses run with your current user.