docker buildx bake: Build Multiple Targets from a File
Build many images at once from a declarative bake file.
docker buildx bake builds one or more targets defined in an HCL, JSON, or compose file. This page covers the bake file, target groups, and overrides in CI.
What it does
bake reads a docker-bake.hcl (or compose/JSON) file describing named build targets and groups, then builds them with BuildKit - often in parallel. It is how you express a fleet of images declaratively instead of many build commands.
Common usage
docker buildx bake
docker buildx bake api worker # specific targets
docker buildx bake --set *.platform=linux/amd64,linux/arm64
docker buildx bake -f docker-bake.hcl --pushCommon errors in CI
"failed to find target X" means the name is not defined in the bake file or referenced group - check the target/group blocks. "no bake definition found" means there is no docker-bake.hcl/json or compose file in the directory; pass -f. Override values per target with --set target.key=value (e.g. tags or platform) rather than editing the file in CI.