How to build my custom base image?


I would like to create a base image for my project. The image would be based on resin/raspberry-pi2-node6, on top of which I would install some libraries. Example of Dockerfile:

FROM resin/raspberry-pi2-node:6 

COPY qemu-arm-static /usr/bin/

RUN apt-get update && apt-get install -y tar wget git && rm -rf /var/lib/apt/lists/*

docker build -t mycompany/raspberry-pi2
docker push mycompany/raspberry-pi2

I would then be able to base my project on this image

FROM mycompany/raspberry-pi2 

When I tried to build the image on my local Linux, I got the error

exec format error
[8] System error: exec format error

I guess this is because I am trying to build the image from a non ARMv6 architecture. Is it possible to emulate this architecture on my local machine or should I build from a Raspberry Pi 2 ?

Thanks for your help


Hi @benoitguigal ! Maybe this will help you: (though building on a Pi will work too, only it’ll probably be slower)


In particular, from that blogpost, I think all you need to do is:

mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc  
echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm-static:' > /proc/sys/fs/binfmt_misc/register  

And then you don’t need to copy qemu-arm-static, everything should work out of the box (as our base images already have it).


It works like a charm ! Thank you



Yes, you will need to build any custom base image and then make it publicly available on Dockerhub for our Builder to be able to use it when building Applications.

We have a small article on how to do this here.

Hope this helps!