From bb7274e948f8565ce2df0c0fb2fd4859c346df5b Mon Sep 17 00:00:00 2001 From: Aleksandr Karpinskii Date: Thu, 11 Dec 2025 19:07:04 +0400 Subject: [PATCH] Clarify what the ARG instruction actually does during build Signed-off-by: Aleksandr Karpinskii --- frontend/dockerfile/docs/reference.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/dockerfile/docs/reference.md b/frontend/dockerfile/docs/reference.md index 5cb659f2df18..7a0e29eb3ede 100644 --- a/frontend/dockerfile/docs/reference.md +++ b/frontend/dockerfile/docs/reference.md @@ -2430,9 +2430,15 @@ Therefore, to avoid unintended operations in unknown directories, it's best prac ARG [=] [[=]...] ``` -The `ARG` instruction defines a variable that users can pass at build-time to +The `ARG` instruction defines a variable that users can pass at build time to the builder with the `docker build` command using the `--build-arg =` -flag. +flag. This variable can be used in subsequent instructions such as `FROM`, `ENV`, +`WORKDIR`, and others using the `${VAR}` or `$VAR` template syntax. +It is also passed to all subsequent `RUN` instructions as a build-time +environment variable. + +Unlike `ENV`, an `ARG` variable is not embedded in the image and is not available +in the final container. > [!WARNING] > It isn't recommended to use build arguments for passing secrets such as