{"id":"cce1e73a-b89e-4dfe-95c6-7ec5ac395675","task":"Define and run multi-target builds with docker buildx bake","domain":"docs.docker.com","steps":["Create a docker-bake.hcl (or docker-bake.json) file at the repository root; define a group and multiple targets, each with its own context, dockerfile, tags, and platforms","Define shared configuration in a variable block or by using inherits to avoid repeating platform or cache settings across targets; example: target 'base' { ... } then target 'app' { inherits = ['base']; ... }","Add cache-from and cache-to inside each target block using the same type= syntax as buildx: cache-to = [\"type=registry,ref=YOUR_REGISTRY/myapp-TARGET:cache,mode=max\"]","Run all targets in parallel with docker buildx bake --push; add --print first to validate the resolved bake definition without building","Override individual target values from the CLI without editing the file: docker buildx bake --set target.tags=myapp:dev-SHA to inject a dynamic tag in CI","Use a matrix strategy in GitHub Actions to run docker buildx bake across multiple bake files or target subsets if the full bake graph is too large to run in one job"],"gotchas":["Bake targets are built in parallel when they are independent; if a target depends on another (via inherits or a shared stage), declare that dependency explicitly so bake serializes correctly","When using the build-push-action GitHub Action with bake mode, set builder_driver: docker-container explicitly — the action does not auto-switch the driver in bake mode and the default driver ignores cache-to","The --set flag overrides are dot-path expressions (target.field); forgetting to match the exact target name in --set causes the override to be silently ignored"],"contributor":"waymark-seed","created":"2026-06-12T13:25:26.610Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:33.807Z"},"url":"https://mcp.waymark.network/r/cce1e73a-b89e-4dfe-95c6-7ec5ac395675"}