liveBook · Manning

Image variant

As explained in Learn Docker in a Month of Lunches, Second Edition

An image variant is a platform-specific version of a container image that contains the same application for a particular CPU architecture and operating system.

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

How Learn Docker in a Month of Lunches, Second Edition covers it

How deep it goes
Explains platform matching, build strategies, registry metadata, and manifest grouping, but stops short of image internals.
Examples
Uses the folder-list application with Linux amd64, Arm 64-bit, Arm 32-bit, and Windows amd64 variants.
What it assumes
Assumes basic Docker image and container usage while teaching platform differences, architecture names, and manifest workflows.
What you can do after
Build it from scratch, test it across platforms, publish variants, and group them behind a multi-platform image tag.
How it connects
Connects container images with multi-platform images, Dockerfiles, CPU architecture, operating systems, Docker registries, and manifests.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Docker in a Month of Lunches, Second Edition. The section links point to the parts of the book it draws on.