Sub topic 6
How a pull chooses the right manifest
This chapter assumes you can build, tag, run and push images, and that you know what an image index is: a list of per-platform manifests, each addressed by digest. Here you will see how a client turns one tag into one manifest, and how to override that choice.
The resolution steps
When you run docker pull alpine:3.20 or docker run alpine:3.20, the client does not download an image directly. It follows these steps:
- It asks the registry for the content behind the tag
3.20. - The registry returns either a single image manifest or an image index.
- If it is an index, the client reads each entry's
platformfield (os,architecture, and sometimesvariant). - The client compares those entries with the platform it wants. By default that is the platform of the Docker daemon host. With
--platform, it is the value you give. - The client fetches the matching manifest by its digest, then the config and layers that manifest lists.
The tag is only used in step 1. After that, everything is fetched by digest.
Matching rules
The client matches os and architecture exactly. The variant field needs more care:
- If you ask for
linux/arm64and the index has anarm64entry with variantv8, that entry matches. Docker treatsv8as the default for 64-bit ARM. - For 32-bit ARM,
linux/arm/v7andlinux/arm/v6are separate entries. A 32-bit ARM host can usually runv6images, so it prefersv7and falls back tov6. - If no entry matches, the pull fails.
Typical failure messages are no matching manifest for linux/arm64/v8 in the manifest list entries or, for a single-platform image, a warning that the image platform does not match the host.
Overriding the choice
Use --platform to select a different entry from the same tag. The tag stays the same and the selected manifest changes.
docker run --rm --platform linux/arm64 alpine:3.20 uname -m
docker run --rm --platform linux/amd64 alpine:3.20 uname -mThe first command prints aarch64 and the second prints x86_64. On a host whose CPU differs from the requested platform, the container runs under emulation if QEMU handlers are registered. If they are not, you get an exec format error.
Local cache and mixed platforms
Docker stores images by tag and platform. If you pulled alpine:3.20 for arm64, then request amd64, Docker pulls the second variant. The tag can now point to whichever platform you pulled last, so check with docker image inspect --format '{{.Os}}/{{.Architecture}}' alpine:3.20 when behavior surprises you.
Common errors
| Symptom | Likely cause |
|---|---|
| `no matching manifest for linux/arm64/v8` | The index has no entry for your platform. |
| `exec format error` at container start | A single-platform image for another architecture, run without emulation. |
| Platform mismatch warning | The tag resolves to a plain manifest, not an index, and its platform differs from the host. |
| Unexpected architecture after `--platform` | An earlier pull cached a different platform under the same tag. |
Exercise
You run docker pull --platform linux/arm64 app:1.0 on an amd64 laptop. The registry returns an index with only amd64 and s390x entries. What happens, and why?
Show answer
The pull fails with a "no matching manifest" error. The client matches the requested platform, linux/arm64, against each entry's platform field. Neither amd64 nor s390x matches, and the client does not fall back to another architecture. The host CPU is irrelevant because --platform overrides it.