Challenge, Easy,  on  Containers

Docker 101: Pull a Container Image for a Specific Platform

An image reference like docker.io/library/nginx:alpine describes where an image lives - registry, repository, and tag - but it says nothing about the target platform (OS and CPU architecture). So how does docker pull still fetch the right build on an arm64 laptop and an amd64 server?

The trick is that in the case of a multi-platform image, its reference actually points not to a concrete build but to an OCI Image Index that bundles one OCI Image Manifest per supported platform. When you run docker pull <ref>, Docker looks up a specific manifest in the index first, and only then fetches the actual build for the requested platform (which defaults to the host's platform).

A multi-platform image is an OCI Image Index pointing to one OCI Image Manifest per target platform.

This playground runs on linux/amd64, so a plain docker pull nginx:alpine would fetch the amd64 build. But what if you need to pull the arm64 build instead - for instance, to inspect it before shipping to an ARM server?

Pull the linux/arm64 variant of nginx:alpine:

Hint 1

docker pull accepts a --platform <os>/<arch> flag that overrides the default platform selection. Valid values look like linux/amd64, linux/arm/v7, linux/ppc64le, etc.

Hint 2

You can verify the platform of a pulled image with:

docker image inspect nginx:alpine --format '{{.Os}}/{{.Architecture}}'