Skip to content

man/docker-build: fix/expand --build-arg - #2012

Merged
thaJeztah merged 1 commit into
docker:masterfrom
kolyshkin:build-man
Oct 19, 2026
Merged

thaJeztah merged 1 commit into
docker:masterfrom
kolyshkin:build-man

Conversation

@kolyshkin

@kolyshkin kolyshkin commented Jul 18, 2019 •

Copy link
Copy Markdown
Contributor
  • Explain that variable value is optional and is taken from environment if not set.
  • Clarify the meaning of ARG, and mention that ENV overrides ARG of the same name.
  • Move example to the end.
  • Refer to the Dockerfile and buildx docs for more details (replacing the obsolete link).

@thaJeztah thaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! left a comment/suggestion

Comment thread man/docker-build.1.md Outdated

These variables then are accessed like regular environment variables
in a `RUN` instruction of the Dockerfile. This mechanism is not meant
for passing secret values.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should also mention that if both an ENV, and an ARG is defined, that the ARG takes precedence and will override the value of the ENV.

While working on this, could you also update the online reference docs so that the descriptions match? https://github.com/docker/cli/blob/master/docs/reference/commandline/build.md#set-build-time-variables---build-arg

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased and updated.

Perhaps we should also mention that if both an ENV, and an ARG is defined, that the ARG takes precedence and will override the value of the ENV.

It's actually the other way around: per the Dockerfile reference, "Environment variables defined using the ENV instruction always override an ARG instruction of the same name", so that's what the text says now.

could you also update the online reference docs so that the descriptions match? https://github.com/docker/cli/blob/master/docs/reference/commandline/build.md#set-build-time-variables---build-arg

--build-arg there now merely links to the buildx docs, so instead of duplicating it I added links to both the Dockerfile reference and buildx docs.

Explain that variable value is optional and is taken from environment
if not set.

Clarify the meaning of ARG, and mention that ENV overrides ARG of the
same name.

Move example to the end, and refer to the Dockerfile and buildx docs
for more details (replacing the obsolete link).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@kolyshkin

Copy link
Copy Markdown
Contributor Author

Some time has passed since I opened this, and I guess I was busy with other things, but somehow I found it today and decided to revive. Feels strange but why not.

@kolyshkin
kolyshkin requested a review from thaJeztah October 19, 2026 08:19
@thaJeztah thaJeztah added this to the 29.10.0 milestone Oct 19, 2026

@thaJeztah thaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx! Yeah we still should look for buildx to provide proper man-pages (as the CLI now only covers the classic builder); also to move the Dockerfile man-page.

LGTM

@thaJeztah
thaJeztah merged commit e300e52 into docker:master Oct 19, 2026
104 of 106 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants