Sub topic 8
Pushing the result to a registry
This chapter assumes you have a working Buildx builder and can build for several platforms with --platform. You should also be able to log in to a container registry with docker login.
Why a multi-platform build cannot stay local
A multi-platform build produces several images and a manifest list that points to them. The classic Docker image store holds one image per tag, so it cannot keep that list. If you add --load to a build with two platforms, Buildx refuses:
docker buildx build --platform linux/amd64,linux/arm64 -t app:1.0 --load .The error says that multiple platforms feed into one image and the current store does not support it. You have three ways to get the result out of the builder:
| Output | Flag | Use it when |
|---|---|---|
| Registry | `--push` | You want others, or other machines, to pull the image. |
| Local image | `--load` | You build one platform and want to run it locally. |
| OCI archive | `--output type=oci,dest=app.tar` | You want a file to inspect or move by hand. |
Docker setups that use the containerd image store can keep multi-platform images locally. Do not rely on that if your builds must run on other machines. A registry works on every setup.
Log in, then build and push
Authenticate first. Buildx reads the credentials that docker login stored.
docker login registry.example.comThen build and push in one command:
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t registry.example.com/team/app:1.0 \
--push .--push is shorthand for --output type=image,push=true. The image never lands in your local docker images list. Buildx uploads it straight from the builder.
What happens during the push
Buildx builds each platform, then uploads in this order. The layers and a config blob for each platform go first. After that, one manifest per platform. The manifest list that names them all goes last, under your tag.
Layers that the registry already has are skipped. A layer shared by both platforms, such as a script copied from your source tree, is uploaded once.
Common push problems
- Authentication errors. With the
docker-containerdriver, the build runs in a container, but Buildx still sends your local credentials. If login works withdocker pushbut fails here, check that you logged in as the same user that runs Buildx. - Registry support. The registry must accept OCI image indexes or Docker manifest lists. Docker Hub, GitHub Container Registry, and Amazon ECR do. Some older or minimal registries do not.
- Extra entries in the index. Recent Buildx versions add provenance and SBOM attestations by default. These appear as additional manifests with platform
unknown/unknown. They are expected. You can turn them off with--provenance=falseif a tool cannot handle them. - Insecure registries. A plain-HTTP registry needs a builder configuration that marks it as insecure. The Docker daemon's own setting does not apply to a
docker-containerbuilder.
The next chapter shows how to confirm that the registry holds what you expect.
Exercise
You run docker buildx build --platform linux/amd64,linux/arm64 -t app:1.0 --load . and the build fails at the export step. Why does it fail, and what is the smallest change that gives you a working multi-platform result?
Show answer
The local image store cannot hold a manifest list, so --load does not work with more than one platform. Replace --load with --push and use a tag that includes a registry name, for example registry.example.com/team/app:1.0. After docker login, the build uploads the per-platform images and the manifest list. Alternatively, build one platform at a time with --load.