Junior — Middle
What parameters and settings are specified in the User directive inside a Dockerfile?
sobes.tech AI
Answer from AI
The USER directive in a Dockerfile sets the user and (optionally) group under which subsequent commands will be executed in the container. The format can be:
USER <user>[:<group>]
<user>— the username or UID.<group>— the group name or GID (optional).
If USER is not specified, the default is root. Setting a user is useful for security reasons, to prevent processes from running with administrator privileges.
Example:
USER appuser:appgroup
After this directive, all commands will be executed as appuser in the appgroup group.