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?
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.
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.
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.
Your solution seems great.
I was wondering if it is possible to give as some useful links or further explanation.
Do you think resin.iohttps://resin.io/how-it-works/ does something similar
Thanx in advance
I finally managed to implement it. I will try to describe the required steps.
Install Jenkins with 2 plugins GitHub plugin + Publish Over SSH.
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 deploy.sh $image = docker/repo docker build -t $image example/ docker push $image
In dockerhub you create your repo and webhooks for every single raspberry.
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 (deploy.sh). 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.