Skip to content

Commit 16fda9c

Browse files
author
David Karlsson
committed
docs: clarified build argument example by changing the variable name
We've received feedback from users who were confused that we were using `user` as the build arg in this example. The cause of the confusion was that `user` is too similar to the pre-defined `$USER` variable. Changing to `username` to hopefully remediate this issue. Signed-off-by: David Karlsson <[email protected]>
1 parent 1e1a9fc commit 16fda9c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

frontend/dockerfile/docs/reference.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,25 +2043,25 @@ elsewhere. For example, consider this Dockerfile:
20432043

20442044
```dockerfile
20452045
FROM busybox
2046-
USER ${user:-some_user}
2047-
ARG user
2048-
USER $user
2046+
USER ${username:-some_user}
2047+
ARG username
2048+
USER $username
20492049
# ...
20502050
```
20512051

20522052
A user builds this file by calling:
20532053

20542054
```console
2055-
$ docker build --build-arg user=what_user .
2055+
$ docker build --build-arg username=what_user .
20562056
```
20572057

2058-
The `USER` at line 2 evaluates to `some_user` as the `user` variable is defined on the
2059-
subsequent line 3. The `USER` at line 4 evaluates to `what_user` as `user` is
2058+
The `USER` at line 2 evaluates to `some_user` as the `username` variable is defined on the
2059+
subsequent line 3. The `USER` at line 4 evaluates to `what_user`, as the `username` argument is
20602060
defined and the `what_user` value was passed on the command line. Prior to its definition by an
20612061
`ARG` instruction, any use of a variable results in an empty string.
20622062

20632063
An `ARG` instruction goes out of scope at the end of the build
2064-
stage where it was defined. To use an arg in multiple stages, each stage must
2064+
stage where it was defined. To use an argument in multiple stages, each stage must
20652065
include the `ARG` instruction.
20662066

20672067
```dockerfile

0 commit comments

Comments
 (0)