bake: add --var flag for setting variable values#3610
Merged
tonistiigi merged 2 commits intodocker:masterfrom Jan 16, 2026
Merged
bake: add --var flag for setting variable values#3610tonistiigi merged 2 commits intodocker:masterfrom
tonistiigi merged 2 commits intodocker:masterfrom
Conversation
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This provides alternative way to set values for Bake variables without adding them the global environment variables. This can also be used then environment variable access is disabled with BUILDX_BAKE_DISABLE_VARS_ENV_LOOKUP. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
e7a65e0 to
c5322ca
Compare
crazy-max
approved these changes
Jan 16, 2026
Member
There was a problem hiding this comment.
LGTM
Needs docs follow-up in reference and docs repo: https://docs.docker.com/build/bake/variables/ (cc @dvdksn)
| | [`--push`](#push) | `bool` | | Shorthand for `--set=*.output=type=registry`. Conditional. | | ||
| | [`--sbom`](#sbom) | `string` | | Shorthand for `--set=*.attest=type=sbom` | | ||
| | [`--set`](#set) | `stringArray` | | Override target value (e.g., `targetpattern.key=value`) | | ||
| | `--var` | `stringArray` | | Set a variable value (e.g., `name=value`) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This provides an alternative way to set values for Bake
variables without adding them to the global environment variables.
This can also be used when environment variable access
is disabled with
BUILDX_BAKE_DISABLE_VARS_ENV_LOOKUP.