BuildKit is the engine that turns your Dockerfile into a runnable image. The old builder worked like a single chef in a kitchen—cooking each step in order, even if some tasks could happen simultaneously. BuildKit is like a modern restaurant kitchen: it parallelizes independent steps, caches everything aggressively, and only rebuilds what actually changed.
The key innovation is the build graph. BuildKit analyzes your Dockerfile as a dependency tree. If step 3 doesn’t need step 2’s output, they run at the same time. It also caches each layer individually in a content-addressable store—if a layer’s inputs haven’t changed, BuildKit skips recomputing it entirely.
BuildKit enables advanced features like multi-platform builds (compiling for ARM and x86 simultaneously), secrets management (injecting credentials without baking them into layers), and SSH forwarding (accessing private repos during build). It’s also extensible through frontends—you can even use non-Dockerfile formats like Buildpacks or Mockerfiles.
To enable it: export DOCKER_BUILDKIT=1 or add "features": {"buildkit": true} to your daemon config. Since Docker 23.0, it’s the default. If you’re still using the legacy builder, you’re leaving performance on the table.
