advancedTop 100 Interview Questions
Why might a production Dockerfile explicitly set a non-root USER?
Running as root inside a container means that if an attacker achieves code execution, they have root privileges within that container's namespace, increasing the impact of any container-breakout vulnerability. Switching to a dedicated non-root user limits the blast radius of a compromise.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response