I'm trying to understand how to build arm images on x86 here, but i'm having hard time.
What I would like to achieve is the following:
- Have a single dockerfile to build both ARM/x86 images.
- Have a command to execute on the CI agent that explicitly define the architecture for which I want to build my image.
The steps seems to be the following:
Add binary of QEMU for ARM in the base image. Everybody suggests to use prebuilt images with the binary in it (like
resin/rpi-raspbian)Register the QEMU binary in the CI build agent by running the following command:
docker run --rm --privileged multiarch/qemu-user-static:register -- reset
Beside the fact that I don't understand all the magic underneath these 2 steps, I kind of understand step 2 after trying it on my laptop: It generates a bunch of binaries which need to be used to simulate the desired architecture.
- If I'm generating binaries using command in step 2, why would I need an image with binary of QEMU for ARM in it?
- My current base image is a
debian:strechand I can generate an ARM image successfully on an ARM device, why would I need to use an ARM specific image? Can't I achieve what I need keeping thedebian:strech? I'm asking this, because I would like to have a single docker file to build images for both x86 and ARM.
If someone could bring some light on this I would really appreciate it.