buildx bake overrides declared secret sources
Introduced 2026-07-29 · score 0.96
HOW TO USE IT
When a Bake target already declares a secret, override that secret’s source for this invocation with `--set target.secret.<id>=...`, using an existing secret source attribute such as `env=` or `src=`. The secret ID must already be declared by the target.
docker buildx bake --set <target>.secret.<id>=env=<ENV_VAR>docker buildx bake --set <target>.secret.<id>=src=<FILE_PATH>WHY THIS HELPS
Build a Bake target that already declares a secret, supplying its source for this invocation.
REQUIREMENTS AND LIMITATIONS
- Version: v0.36.0
- --set (required): Override a target configuration using `targetpattern.key[.subkey]=value`; repeatable.
- <target> (required): Bake target whose declared secret source is being overridden; target patterns are supported.
- secret.<id> (required): Selects the source override for a secret already declared by the target. The secret ID must already exist; any inline `id=` must match. The `secrets.<id>` plural alias is invalid for this form.
- env=<ENV_VAR> (required): Names the environment variable used as the secret source.
- src=<FILE_PATH> (required): Names the file used as the secret source.
- Prerequisite: Buildx must be installed to use `docker buildx bake`.
- Prerequisite: The secret must already be declared by the target.
- The secret must already be declared by the target.
- The override fails if the secret ID is not already declared or if an inline `id=` does not match.
FIRST-PARTY EVIDENCE
- https://github.com/docker/buildx/releases/tag/v0.36.0
- https://github.com/docker/buildx/pull/3962
- https://docs.docker.com/build/bake/reference/
- https://docs.docker.com/reference/cli/docker/buildx/bake/
- https://docs.docker.com/build/bake/introduction/
Check the installed version and the source before using it. Entry JSON