BuildKit 10,294 (https://github.com/moby/buildkit 10,294 ) (Apache-2.0) replaced the original builder, which ran a Dockerfile top to bottom, one instruction at a time. It arrived in Docker 18.09 514 behind DOCKER_BUILDKIT=1 and became the default on Linux in Engine 23.0 (February 2023), when docker build became an alias for docker buildx build. Engine 29.8.1 embeds BuildKit 0.33.0. It works like a compiler:

A frontend, itself an image named by the # syntax= line, parses the Dockerfile into LLB (low-level build), a graph of operations and their inputs. The solver gives every node a cache key computed from its inputs, reuses cached nodes, runs the rest in containers, in parallel where the graph allows, and an exporter writes the result to the image store, a registry, a tar file or a directory. Identical steps in two stages share one key, and stages the target does not need are skipped. The legacy builder (DOCKER_BUILDKIT=0) runs every stage in file order and stops at BookNest's first cache mount: "the --mount option requires BuildKit".