Skip to content

Commit 9f39693

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

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

docs/reference/run.md

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

13191319
### User
13201320

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

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

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

1331-
The followings examples are all valid:
1332-
--user=[ user | user:group | uid | uid:gid | user:gid | uid:group ]
1332+
```text
1333+
--user=[ user | user:group | uid | uid:gid | user:gid | uid:group ]
1334+
```
13331335

1334-
> **Note:** if you pass a numeric uid, it must be in the range of 0-2147483647.
1335-
> If you pass a username, the user must exist in the container.
1336+
> **Note**
1337+
>
1338+
> If you pass a numeric user ID, it must be in the range of 0-2147483647. If
1339+
> you pass a username, the user must exist in the container.
13361340
13371341
### Working directory
13381342

0 commit comments

Comments
 (0)