Buildx extends Docker’s build commands with an optimized build engine while keeping Dockerfiles as input and images as output. It acts as a replacement for docker image build and supports distributed, multi-platform builds across Docker Engines. section 12.4
A practical Buildx workflow uses:
- Docker contexts to describe connections to Docker Engines. section 12.4
- Builder nodes, each assigned a target platform such as linux/amd64 or linux/arm64. section 12.4
- A single build command that builds and pushes a multi-platform image. section 12.4
Create a small multi-platform build farm
Duplicate the current Docker context, create a builder with amd64 and arm64 nodes, then run docker buildx build with --platform linux/arm64,linux/amd64 and --push. Two contexts can point to one local engine for practice; real farms use networked engines secured with SSH or TLS. section 12.4
# build and push the hello app for all the builder's platforms: docker buildx build --builder ch12-builder ` --platform linux/arm64,linux/amd64 ` -t "$dockerId/ch12-hello-x:2e" ` --push ./hello
Inspect the complete build-and-push command for the example application. section 12.4
