Sub topic 14
Building each architecture separately and merging manifests
This chapter assumes you can build and push an image with Buildx, and that you know a manifest list maps platforms to images. It also assumes you have two machines, one amd64 and one arm64, each able to push to your registry.
Why build separately
A single multi-node builder is convenient, but it needs network access from one controlling machine to every node. Sometimes that is not possible. Your arm64 runner may sit in another CI system, or on a different network. In that case, build on each machine alone and combine the results afterwards.
The pattern has two stages:
- Each native machine builds and pushes a tag for its own architecture.
- One job creates a manifest list that points at those tags.
This avoids emulation entirely, because each build runs on its own CPU.
Step 1: build and push one tag per architecture
On the amd64 machine, build only for the host platform and push with an architecture suffix:
docker buildx build \
--platform linux/amd64 \
-t registry.example.com/team/app:1.0-amd64 \
--push .On the arm64 machine, run the same command with linux/arm64 and the 1.0-arm64 tag. Each tag now points to a single-platform image.
Step 2: merge the tags
Run this from any machine that is logged in to the registry:
docker buildx imagetools create \
-t registry.example.com/team/app:1.0 \
registry.example.com/team/app:1.0-amd64 \
registry.example.com/team/app:1.0-arm64imagetools create reads the manifests of the source tags, reads the platform recorded in each one, and writes a new manifest list under the target tag. It does not pull or rebuild layers. The layer data stays where it is, and the registry only stores a small new manifest. This is why the merge takes seconds.
Check the result
Inspect the new tag to confirm both platforms are present:
docker buildx imagetools inspect registry.example.com/team/app:1.0The output should list one manifest for linux/amd64 and one for linux/arm64, each with its own digest. Those digests should match the ones on the per-architecture tags.
Gotchas
- Both tags must exist first. If the merge job runs before one build finishes, the command fails because the source tag cannot be found. Make the merge job depend on both builds.
- Source tags must be single-platform images. Each source is expected to describe one platform. Merging tags that are already multi-platform lists is not what this pattern is for.
- Per-architecture tags stay in the registry. Tags such as
1.0-amd64remain visible after the merge. Some teams keep them for debugging, others delete them with a registry cleanup policy. - Pin by digest when you can. A tag like
1.0-amd64can be overwritten between the build and the merge. Usingrepo@sha256:...as the source avoids merging the wrong image. - Provenance and SBOM attestations. Recent Buildx versions add attestation manifests to pushed images. These can appear as extra
unknown/unknownentries in the inspect output. They are not extra platforms.
When to choose this approach
Use it when the nodes cannot be joined into one builder, or when separate CI jobs are easier to schedule and retry than one large build. Use a single builder with native nodes when you can reach all machines from one place, because it needs only one command.
Exercise
A team builds app:2.0-amd64 and app:2.0-arm64 on separate runners. Which command publishes app:2.0 as a multi-platform tag, and does it need to download the image layers?
Show answer
Run docker buildx imagetools create -t registry.example.com/team/app:2.0 registry.example.com/team/app:2.0-amd64 registry.example.com/team/app:2.0-arm64. It does not download layers. It reads the source manifests and writes a new manifest list in the registry.