CCSP Cloud Application Security Practice Question
A cloud application developer is using a containerized application with Docker. The security team requires that the application runs with the least privilege possible. Which of the following is the BEST practice to ensure the container does not run as root?
⚠ Common exam trap
ISC2 often tests the distinction between runtime flags (like --user or --cap-drop) and build-time directives (like USER), and candidates mistakenly think dropping capabilities is equivalent to running as a non-root user.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Include a USER directive in the Dockerfile to specify a non-root user.
The USER directive in a Dockerfile sets the user for any subsequent RUN, CMD, or ENTRYPOINT instructions, ensuring the container process runs as a non-root user by default. This is the most direct and persistent method to enforce least privilege at build time, as it becomes part of the image itself and applies regardless of runtime flags.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use the --no-root flag when starting the container.
Why it's wrong here
There is no --no-root flag in Docker.
- ✓
Include a USER directive in the Dockerfile to specify a non-root user.
Why this is correct
This is the standard way to run a container as a non-root user.
- ✗
Set the securityContext.runAsNonRoot parameter in the container manifest.
Why it's wrong here
This is a Kubernetes concept, not Docker.
- ✗
Use the --cap-drop=ALL option when running the container.
Why it's wrong here
This drops capabilities but does not change the user ID; the container may still run as root.
Go deeper
Related to this question
About these practice questions
One of 964 original CCSP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CCSP practice question is part of Courseiva's free ISC2 certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CCSP exam.