Browse code

Added documentation for specifying groupname or GID for commands. Also clarified used of the possible use of multiple USER commands in a Dockerfile.

Signed-off-by: Dan Anolik <dan@anolik.net>

Dan Anolik authored on 2015/03/24 12:47:04
Showing 2 changed files
... ...
@@ -273,8 +273,15 @@ A Dockerfile is similar to a Makefile.
273 273
 
274 274
 **USER**
275 275
   -- `USER daemon`
276
-  The **USER** instruction sets the username or UID that is used when running the
277
-  image.
276
+  Sets the username or UID used for running subsequent commands.
277
+
278
+  The **USER** instruction can optionally be used to set the group or GID. The
279
+  followings examples are all valid:
280
+  USER [user | user:group | uid | uid:gid | user:gid | uid:group ]
281
+
282
+  Until the **USER** instruction is set, instructions will be run as root. The USER
283
+  instruction can be used any number of times in a Dockerfile, and will only affect
284
+  subsequent commands.
278 285
 
279 286
 **WRKDIR**
280 287
   -- `WORKDIR /path/to/workdir`
... ...
@@ -341,7 +341,12 @@ The **-t** option is incompatible with a redirection of the docker client
341 341
 standard input.
342 342
 
343 343
 **-u**, **--user**=""
344
-   Username or UID
344
+   Sets the username or UID used and optionally the groupname or GID for the specified command.
345
+
346
+   The followings examples are all valid:
347
+   --user [user | user:group | uid | uid:gid | user:gid | uid:group ]
348
+
349
+   Without this argument the command will be run as root in the container.
345 350
 
346 351
 **-v**, **--volume**=[]
347 352
    Bind mount a volume (e.g., from the host: -v /host:/container, from Docker: -v /container)