Sobes.tech
Junior — Middle

Which user is initiated when launching a container?

sobes.tech AI

Answer from AI

When launching a container, the default user is the one specified in the container image. If the USER parameter is not specified in the Dockerfile, the container runs as the root user.

To change the user, you can add in the Dockerfile:

USER username

Or specify the user at runtime with:

docker run -u username image

Using a non-privileged user increases container security.