Services and User Management

A security review finds that the processes in a container built from a custom Dockerfile run as root. The team wants the application to run as an unprivileged account named appuser that is created in the image. Which addition to the Dockerfile accomplishes this?

Show the answer

Correct answerA. USER appuser after a RUN useradd step

The USER instruction sets the account for later build steps and for the container's running processes. ENV USER only sets an environment variable and does not change the effective user.