Easily Making Container Images for Multiple Platforms

Jamie Duncan
5 min readJul 4, 2020
Building containers for multiple platforms can be an unexpected challenge with a straightforward solution

Recently I began a project where I wanted to do local development on my Intel-based workstation and also deploy it to Kubernetes on my local Raspberry Pi cluster. After about 20 minutes, I got really tired of switching Dockerfile configs around to deploy to the different platform architectures to test small changes. I knew that some larger projects had some sort of magic going on that figured out your platform and handed you the proper image. How could I do that for myself? It turns out that it’s not that hard to accomplish and automate. It’s all built on top of container image manifests.

Note: Right now this is a best practice for container images. When Apple moves to ARM-based chips in 2021, this is going to be absolutely essential for just about every project.

Container Image Manifests

A container manifest is a list of multiple images, their layers, as well as metadata for the images including their intended processor architecture and operating system. An example of a manifest looks like this. In the example below, there are 2 images associated with the manifest. One image is for amd64 systems, and the other is for arm64 systems.

docker manifest inspect jeduncan/some-image:0.2                        
{
"schemaVersion": 2,
"mediaType"…

--

--

Jamie Duncan

App Transformation & GCP @Google. Formerly VMW & Red Hat. Father. Woodworker. F1 Fan. Shitposter.