Docker Community Forums

Share and learn in the Docker community.

Automated Build Raspberry Pi based image on Docker Hub


(Violinbeats) #1

Hi guys, I have a question on automated build on Docker hub. I am using circle CI as the trigger, and a simple node.js app. Once my app passes the test, circle CI will deploy my app to docker hub and build an image. And I am using hypriot/rpi-node as my base image.

In my Dockerfile, when I specify ‘FROM hypriot/rpi-node’ in my docker file, it successfully builds the docker image on my raspberry pi but fails on docker hub with error message ‘exec format failure’, and I had to change it to ‘FROM node’, which is a general node.js image, in order for it to build on Docker hub, then it doesn’t run on my Raspberry Pi. Any suggestion on how to build an rpi image on docker hub?


(Jeff Anderson) #2

The automated build feature on the official Docker Hub only runs the normal x86_64 docker implementation. Since arm code is not something an x86_64 CPU can execute, that’s why you get the ‘exec format failure’ on the automated build system. the normal ‘node’ image is an x86_64 image, so it works.


(Violinbeats) #3

Thanks for letting me know, Jeff! Do you know if there is a way to automatic build arm image after circle CI and push the image to docker hub? Right now I am thinking that an alternative is to have a local docker registry that build arm images.


(Jeff Anderson) #4

You wouldn’t need to run a local registry, just run a CI solution that can talk to a docker daemon running on arm. All it would need to do is build and then push.

If I were to do something like that, I’d run jenkins on digitalocean or ec2 or a local esxi host. I’d set docker up on a raspberry pi or another arm system capable of running my arm docker images. I’d configure a jenkins job to be able to talk to the arm docker daemon remotely. At that point it would be a simple docker build and then docker push.

You could probably get your circleci to have remote access to your arm docker daemon (and skip the jenkins bit). Just remember that the credentials for your docker daemon that live on the circleci service essentially give root access out to your arm host.


(Donmichael) #5

Your solution seems great.
I was wondering if it is possible to give as some useful links or further explanation.
Do you think does something similar
Thanx in advance

(Jeff Anderson) #6

I haven’t tried out myself, but my understanding is that they basically provide a container building system for arm devices.

(Donmichael) #7

I finally managed to implement it. I will try to describe the required steps.

  1. Install Jenkins with 2 plugins GitHub plugin + Publish Over SSH.
  2. Create a new jenkins job. Then you you connect your job with your repo plus the server (raspberry) that you want to ssh. You also specify the Source files to transfer (Dockerfile etc) within a folder (example/) plus an exec command sh
    $image = docker/repo docker build -t $image example/ docker push $image
  3. In dockerhub you create your repo and webhooks for every single raspberry.
  4. In your raspberry you run a server that listens for docker images pull.
  5. On github you need to create a webhook with your jenkins server

When a change is pushed to Github, a web hook will trigger your Jenkins to run a build. Jenkins will connect your raspberry through SSH (Publish Over SSH., jenkins plugin) send github files, and run the script ( The script will build an image and pull it to Dockerhub. Dockerhub will send HTTP POST request to all webhooks. Your raspberries will listen for such request, and automatically will run the new image.