sincecutoff.com
← all changes

Bake --var sets variables from the command line

Introduced 2026-01-22 · score 0.98

HOW TO USE IT

When a repository build needs Bake variable values supplied on the command line, run `docker buildx bake` with `--var name=value` and the target to build. This sets the variable without setting an environment variable.

docker buildx bake --var <name>=<value> <target>

WHY THIS HELPS

Set Bake variable values for a repository build without setting environment variables.

BEFORE THIS CHANGE

Set variable values using environment variables.

REQUIREMENTS AND LIMITATIONS

  • Version: v0.31.0
  • --var <name>=<value>: Sets a Bake variable value; the documented value format is `name=value`.
  • <target>: Names a Bake target to build; the CLI also accepts no target argument.
  • Prerequisite: Buildx must be installed to use `docker buildx bake`. The `--var` flag is available in Buildx v0.31.0.
  • Prerequisite: The repository needs a Bake definition; Bake searches the current working directory for one when `--file` is omitted.

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card