The USER instruction

The USER instruction sets the startup user ID or username in the new image. By default, the containers will be launched with root as the user ID or UID. Essentially, the USER instruction will modify the default user ID from root to the one specified in this instruction.

The syntax of the USER instruction is as follows:

USER <UID>|<UName> 

The USER instructions accept either <UID> or <UName> as its argument:

  • <UID>: This is a numerical user ID
  • <UName>: This is a valid username

The following is an example for setting the default user ID at the time of startup to 73. Here, 73 is the numerical ID of the user:

USER 73 

Though it is recommended that you have a valid user ID to match with the /etc/passwd file, the user ID ...

Get Learning Docker - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.