CV0-004 · Question #235
A cloud engineer is reviewing the following Dockerfile to deploy a Python web application: Which of the following changes should the engineer make to the file to improve container security?
The correct answer is A. Add the instruction USER nonroot. Adding USER nonroot ensures that the application runs as a non-root user within the container, reducing the risk of privilege escalation and limiting the damage that could be done if the container is compromised. Running containers as root is generally discouraged for security
Question
A cloud engineer is reviewing the following Dockerfile to deploy a Python web application:
Which of the following changes should the engineer make to the file to improve container security?
Options
- AAdd the instruction USER nonroot.
- BChange the version from latest to 3.11.
- CRemove the instruction.
- DEnsure myapp/main/py is owned by root.
How the community answered
(41 responses)- A83% (34)
- B5% (2)
- C10% (4)
- D2% (1)
Explanation
Adding USER nonroot ensures that the application runs as a non-root user within the container, reducing the risk of privilege escalation and limiting the damage that could be done if the container is compromised. Running containers as root is generally discouraged for security
Topics
Community Discussion
No community discussion yet for this question.