BuildKit and Buildx: who builds the image?
A small example
FROM busybox:1.37RUN printf "built locally\n" > /result.txtCMD ["cat", "/result.txt"]Buildx sends a build definition to a builder. The Dockerfile frontend converts instructions into a dependency graph that BuildKit solves. Independent operations may execute concurrently. The builder may use a local engine or a separate process or remote endpoint, depending on driver. Its cache and image output location are not automatically shared with other builders. This example uses an approved local docker driver only. --load requests a single-platform image in the local image store, rather than pushing to a registry. The selected Buildx builder and the Engine default builder can differ; check the builder used by the exact command, not just the star in a listing. The loaded image ID is not a registry manifest digest.
Try it in a local lab
Manual lab, not a ByteMind executable exercise. Use a new approved disposable Linux VM with blocked network egress and a local Engine and Buildx docker driver. Check docker context show, docker version, docker buildx version and docker buildx ls before doing anything. Confirm the reviewed, preloaded busybox:1.37 for the native platform, expected default user, no entrypoint, required applets and bundled frontend support for RUN mounts. Record its actual digest and versions. If a dependency needs to be fetched or the builder is remote, stop. --network none restricts RUN networking, not all builder traffic. Confirm all bm-v09 tags are unused. Run commands individually in the named fixture directory, stopping on any unexpected failure. All values are synthetic; do not use real credentials. Expected results are predictions, not observed output. Before querying or building, confirm DOCKER_HOST, DOCKER_CONTEXT and BUILDX_BUILDER overrides and the effective endpoint are approved; do not contact an unapproved endpoint. docker build normally uses the Engine default builder, not necessarily the starred Buildx builder. Record the effective local docker driver and platform; review the synthetic context and ignore rules. After each build, require exit status zero before running its tag; an earlier tag may still exist after failure.
Open lab-fixtures/docker-builds-and-caching/04-buildkit/ in the extracted archive. The Dockerfile and these files are supplied. Work on a disposable copy, not the original archive.
docker build --load --network none --progress=plain -t bm-v09-buildkit:lab .docker run --rm --pull=never --network none bm-v09-buildkit:labdocker buildx versiondocker buildx lsdocker image inspect --format "{{.Id}}" bm-v09-buildkit:labExpect built locally when running the loaded image. The inspection should return an image ID, which varies by build. Builder listing is environment-specific; do not share private endpoint details.
Confirm the tag belongs to this lab and no containers depend on it. Remove only that tag without forcing. Cached data may remain; dispose of the VM rather than clearing a shared cache. Restore any edited fixture or discard the working copy.
Common mistake
A successful build does not necessarily leave an image locally runnable with every driver and exporter. Confirm output location. Do not create or switch remote builders in this lab.
Manual practice
Draw CLI → builder → local image store → container. Identify which part would change if only the builder moved to another approved machine; do not actually connect to it.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
BuildKit and Buildx: who builds the image? — Knowledge check
Apply the build concept to a new scenario.
What solves the build graph?
What does --load request?
What must be checked for the exact build command before it contacts a builder?