Skip to content

Commit 4a84514

Browse files
committed
docs: rewrite section on setting user id
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
1 parent 259aa90 commit 4a84514

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

docs/reference/run.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,21 +1207,25 @@ The health status is also displayed in the `docker ps` output.
12071207

12081208
### User
12091209

1210-
`root` (id = 0) is the default user within a container. The image developer can
1211-
create additional users. Those users are accessible by name. When passing a numeric
1212-
ID, the user does not have to exist in the container.
1210+
The default user within a container is `root` (id = 0). You can set a default
1211+
user to run the first process with the Dockerfile `USER` instruction. When
1212+
starting a container, you can override the `USER` instruction by passing the
1213+
`-u` option.
12131214

1214-
The developer can set a default user to run the first process with the
1215-
Dockerfile `USER` instruction. When starting a container, the operator can override
1216-
the `USER` instruction by passing the `-u` option.
1215+
```text
1216+
-u="", --user="": Sets the username or UID used and optionally the groupname or GID for the specified command.
1217+
```
12171218

1218-
-u="", --user="": Sets the username or UID used and optionally the groupname or GID for the specified command.
1219+
The followings examples are all valid:
12191220

1220-
The followings examples are all valid:
1221-
--user=[ user | user:group | uid | uid:gid | user:gid | uid:group ]
1221+
```text
1222+
--user=[ user | user:group | uid | uid:gid | user:gid | uid:group ]
1223+
```
12221224

1223-
> **Note:** if you pass a numeric uid, it must be in the range of 0-2147483647.
1224-
> If you pass a username, the user must exist in the container.
1225+
> **Note**
1226+
>
1227+
> If you pass a numeric user ID, it must be in the range of 0-2147483647. If
1228+
> you pass a username, the user must exist in the container.
12251229
12261230
### Working directory
12271231

0 commit comments

Comments
 (0)