Node.js · Senior · Question 34 of 75
Why should a Node.js process run as a non-root user in a container?
- 1Node.js refuses to start as root
- ✓Correct answer: If the app is compromised, the attacker gets fewer privileges in the container and on the host
- 3Root processes can't open network ports
Explanation
The official Node.js images include a node user. Combine this with a read-only file system and minimal images for defense in depth.