Skip to content

Commit 79b833a

Browse files
authored
Merge pull request #6411 from homm/clearify-ARG-instruction
Clarify what the ARG instruction actually does during build
2 parents 2160600 + bb7274e commit 79b833a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

frontend/dockerfile/docs/reference.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2430,9 +2430,15 @@ Therefore, to avoid unintended operations in unknown directories, it's best prac
24302430
ARG <name>[=<default value>] [<name>[=<default value>]...]
24312431
```
24322432

2433-
The `ARG` instruction defines a variable that users can pass at build-time to
2433+
The `ARG` instruction defines a variable that users can pass at build time to
24342434
the builder with the `docker build` command using the `--build-arg <varname>=<value>`
2435-
flag.
2435+
flag. This variable can be used in subsequent instructions such as `FROM`, `ENV`,
2436+
`WORKDIR`, and others using the `${VAR}` or `$VAR` template syntax.
2437+
It is also passed to all subsequent `RUN` instructions as a build-time
2438+
environment variable.
2439+
2440+
Unlike `ENV`, an `ARG` variable is not embedded in the image and is not available
2441+
in the final container.
24362442

24372443
> [!WARNING]
24382444
> It isn't recommended to use build arguments for passing secrets such as

0 commit comments

Comments
 (0)