Run Node.js as Non-Root User
- Docker containers by default run as root(!). It’s recommended for Node.js web applications to listen on non-privileged ports and rely on a reverse-proxy like nginx to redirect incoming traffic from port 80 to your Node.js application. When building a Docker image, highly secured apps should run the container with an alternate non-root user. Most Docker clusters (e.g. Swarm, Kubernetes) allow setting the security context declaratively
From the Repository docker-node by eyalzek:
From the blog Don’t run Node.js as root by :
From the blog Developing Secure Node.js Applications — A Broad Guide by Deepal Jayasekara: