Post

Building multi-architecture Docker images

Building multi-architecture Docker images

I had a need to build and publish docker images with support for multiple architectures, namely AMD64 and ARM64.

This turned out to be surprisingly difficult, and I ended up creating a simple golang program that reads a set of per-architecture docker image manifests, generates a multi-architecture manifest list, and then publishes it back to the same registry containing the original images.

This way we can perform our per-architecture image builds using kaniko, which does not support multi-architecture builds, and then combine them into a single multi-architecture image after the fact.

Build

1
$ go build -o docker-multiarch main.go

Usage

1
2
$ ./docker-multiarch
Usage: ./docker-multiarch [-u username] [-p password] destination_image source_image1 source_image2 ...

Example

1
$ ./docker-multiarch myregistry/myimage:mytag myregistry/myimage_arm64:mytag myregistry/myimage_amd64:mytag
This post is licensed under CC BY 4.0 by the author.