An image variant is a platform-specific version of a container image containing the same application for a particular CPU architecture and operating system. Multi-platform images publish several variants under one image name, allowing Docker to pull the matching variant for the host platform. section 12.0
Build image variants using one of these practical approaches:
- Build one multi-stage Dockerfile on different platforms when its SDK and runtime base images support every target architecture. section 12.2
- Maintain platform-specific Dockerfiles when base images lack the required platform support; this increases management effort but allows target-specific behavior. section 12.2
- Push every variant to a registry, then group them under one tag with a manifest so Docker can select the appropriate image. section 12.3
Building and checking folder-list variants
Build the folder-list application separately for linux/amd64, linux/arm64, and linux/arm using platform-specific Dockerfiles and the --platform option. Run each image with its matching platform setting and compare the reported operating system and CPU with the expected values. section 12.2
# create a manifest list with a name # followed by all the tags it contains: docker manifest create "$dockerId/ch12-folder-list:2e" ` "$dockerId/ch12-folder-list:2e-linux-amd64" ` "$dockerId/ch12-folder-list:2e-linux-arm64" ` "$dockerId/ch12-folder-list:2e-linux-arm" # push the manifest to Docker Hub: docker manifest push "$dockerId/ch12-folder-list:2e" # now browse to your page on Docker Hub and check the image
Follow the manifest-list commands to combine pushed platform variants under one image tag and publish the resulting multi-platform image. section 12.3
