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 can contain any random numerical value. However, the username must match with a valid username in the /etc/passwd file, otherwise, the docker run subcommand will fail and it will display the following error message:

finalize namespace setup user get supplementary groups Unable to find user
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset