1

I have a container that is built on top of debian:jessie (there is some openssl compilation and some custom stuff). I want my image to be launchable on different architectures, for example on "normal" x86_64 OSes but also on ARM-based architectures like RaspberryPI.

I found that when I build the image on x86_64 and publish it on HUB, it does not work when is pulled on ARM device and vice versa. Trying to do so results in some "cannot find some libraries" or "unrecognized commands" errors.

The question is: how to build and publish my image so it is available for other architectures (and, what's important - how to tell docker to automatically select the appropriate one when downloading)?

I can see that the debian containers "have been ported" to different architectures but I can't find any information how to accomplish this for my image.

fracz
  • 324
  • 1
  • 12

2 Answers2

3

Multi-arch images in docker are under active development. The key piece of this is a docker manifest cli that is still being developed in this PR.

You first need to create your images for different architectures which you can always run directly on the appropriate architecture system. A multi-arch image is a "manifest list" that will point to these images. The docker client will then pull the appropriate image from that list when you pull the multi-arch image.

Until the above PR is integrated into Docker, you can use the manifest-tool that lets you define the manifest list and push it up to the registry server. This allows an input yaml file like the below example:

image: myprivreg:5000/someimage:latest
manifests:
  -
    image: myprivreg:5000/someimage:ppc64le
    platform:
      architecture: ppc64le
      os: linux
  -
    image: myprivreg:5000/someimage:amd64
    platform:
      architecture: amd64
      features:
        - sse
      os: linux

You then run the below to take the above yaml file and convert it into a manifest list that is pushed to the defined registry:

./manifest-tool push from-spec someimage.yaml
BMitch
  • 5,189
  • 1
  • 21
  • 30
0
  1. Build your image against the relevant architecture's image.
    • eg: arm32v7/debian:jessie instead of debian:jessie
  2. Tag it as something else.
    • eg: fracz/fooapp:arm32-latest, fracz/fooapp:raspi-latest, fracz/fooapp:grandma-use-this-one
  3. Whoever wants to run your image is responsible for selecting the appropriate tag.
    • Though you'd probably want to put some relevant info in your docs/readmes/etc
Sammitch
  • 2,072
  • 1
  • 20
  • 34