Multi-arch Container Image

Zhimin Wen
4 min readDec 6, 2022
Image by Edi Nugraha from Pixabay

You build your application container image on a Linux server, push it over to the Github registry. On your new Apple silicon M1 laptop, you run the image, but received the following warning error message.

podman run -it -d ghcr.io/zhiminwen/niceapp:v1.0
WARNING: image platform ({amd64 linux [] }) does not match the expected platform ({arm64 linux [] })

Check the image,

skopeo inspect docker://ghcr.io/zhiminwen/niceapp:v1.0

{
"Name": "ghcr.io/zhiminwen/niceapp",
...
"Architecture": "amd64",
"Os": "linux",
...

sure enough, the architecture is amd64 only.

Though the container still running, Podman magically emulate the platform as shown below, you may still wonder how to build the multi-arch container images.

[core@localhost ~]$ podman exec -it 96c5d3e46187 sh
/app # ps
PID USER TIME COMMAND
1 root 0:00 {serving} /usr/bin/qemu-x86_64-static /app/./serving
6 root 0:00 {sh} /usr/bin/qemu-x86_64-static /bin/sh
8 root 0:00 /bin/ps

Build Image with Multiple Architecture

For multiple archietecture images, what we can do is to create a list type of manifest that group the different architecture’s image together. Take an example of the golang image…

--

--