Running this command -
docker buildx build --platforms linux/amd64,linux/arm64 -t mytag --push .
It creates an image index and 2 images in my ECR.
- How do I tag the images and the image index in one command? For now I can only tag the image index.
- How can I know for sure that each image is different arch and the image index contains both images?
- If I pull the image index from amd64 or arm64 laptop, would he know to pull the right image for my arch? how? I wanted to have multi arch image, is it the image index?
There are a variety of tools out there for this. The ones I frequently recommend are Google's crane, RedHat's skopeo, and my own regclient. E.g. with regclient/regctl:
You can inspect the manifest, docker now has this built-in:
Or with various other tools:
Yes, the image index is how a registry stores a multi-platform image. It contains an array of descriptors to each other other manifests and their platform. The container runtimes (like docker) know how to pick their local platform from that list. E.g. here's what the busybox multi-platform manifest looks like:
From the comments:
The size in the manifest list is the size of each of the nested manifests, which is also just JSON. You need to look at the size of the filesystem layers within those image manifests to see each image size: