Recently I have worked on a container that I wanted to be able to use on both x86_64 and aarch64 (in other words, on my regular laptop as well as on my raspberry pi). I could build the container on the laptop, push it to quay.io but then the container was failing to start on the raspberry pi, and obviously, the other way around as well.

The question was then: how to make it so that I could easily pull the container image from quay.io for both architectures?

The answer is basically:

  • Build the container for x86_64 and push it to quay.io with a dedicated tag
  • Build the container for aarch64 and push it to quay.io with another dedicated tag
  • Build a container manifest which points to the two tags set above
  • Push that container manifest to quay.io to the latest tag



Here are the corresponding commands:

Build the container (the same command can be used on both machines):
podman build -t <tag> -f <Dockerfile/Containerfile>

for example:

podman build -t remote_builder -f Containerfile
Log into quay.io:
podman login quay.io
Push the image built to the registry:
podman push <image_id> <registry>/<user>/<project>:<tag>

for example:

podman push 56aea0cde6d2 quay.io/pchibon/remote_builder:aarch64

Once these commands have been done on both architectures, you can check the project on quay.io and you should be able to see two tags there.

Create the manifest linking the two tags to the `latest` one:
podman manifest create <registry>/<user>/<project>:latest \
   <registry>/<user>/<project>:<tag-1> \
   <registry>/<user>/<project>:<tag-2>

for example:

podman manifest create quay.io/pchibon/remote_builder:latest \
    quay.io/pchibon/remote_builder:aarch64 \
    quay.io/pchibon/remote_builder:x86_64
Finally, push the manifest to quay:
podman manifest push <user>/<project>:<tag> <registry>/<user>/<project>:<tag>

for example:

podman manifest push pchibon/remote_builder:latest quay.io/pchibon/remote_builder:latest


Note, for some registry (such as the ones hosted on gitlab.com), you may need to specify the manifest version to use, you can do so by using:

podman manifest push --format v2s2



The one question I do not know yet, but will have to check is: does the manifest need to be re-generated/updated everytime the tags are updated or will the latest tag always point to the latest image of each tag.