Docker/ARM64 for HypriotOS
In Part 1 we’ve looked at how to build HypriotOS for Odroid-C2. So far we got to a point where we could build a proper boot iamge. But the most important piece is still missing- Docker.
In my attempt to get HypriotOS running properly on the Odroid, I tried a few different approaches. First of all, I tried what has already been described by Mr.Dreambot as unsuccessful - installing the 32-bit version of the Docker packages on top of my 64-bit HypriotOS. Unsurprisingly, that attempt wasn’t any more successful than the one described in that blog post.
My second attempt was again looking at the HypriotOS infrastructure, this time in the form of the rpi-docker-builder. Adopting that to 64-bit wasn’t much work, but it didn’t give me a proper Docker build either. Apparently the layout of Docker’s bundle folder had changed over time and I wasn’t able to collect all the pieces that I needed for this builder to succeed.
My third attempt was again roughly following in the steps of Mr.Dreambot: building my own version of Docker from the sources. On the bright side, I did not need to apply any of the changes described in that post. Neither did I have to disable 32-bit support, nor was I running out of diskspace or memory during the build. Basically,
make tgz worked as expected. This gave me a nice tar file that I could deploy onto my Odroid-C2, finally allowing me to run Docker on HypriotOS. Hooray!
Building the DEB File
Unfortunately I was looking for a different output because I wanted to properly install the docker-engine package as part of the HypriotOS build process. Thus my next step was to run a
to build the proper packages for Debian Jessie, which is the basis for HypriotOS. As it turned out, creating ARM64 Debian packages for Docker had not yet been implemented - only Ubuntu was supported out-of-the-box.
Adding support for building Debian Jessie packages took much longer than I had anticipated. I mean, there is output for Ubuntu, right? Well, there was a reason why there wasn’t any support for Debian Jessie yet - the absence of a proper Golang toolchain to bootstrap the latest version of Go. I tried all kinds of options for several evenings but didn’t succeed. Until I found a Golang 1.6 package in jessie-backports. This allowed me to come up with a change that I was happy with.
While that change is sufficient to sucessfully run
make dep for both master and - if you apply the same change - v1.13.1, it isn’t enough to run
make all. This requires additional changes to some of the other
Dockerfile.aarch64 in the depot, primarily to add validation tools like golint, yamllint, or swagger.
So far I’ve been able to update the HypriotOS image builder of Odroid-C2 to roughly match the v1.0.0 version for the Raspberry Pi. I’ve also been able to build a docker-engine Debian package that is picked up during the build of the image. It boots sucessfully, comes with docker-engine, docker-compose (32-bit) and docker-machine (32-bit) - I am pretty happy so far.
What’s left? First, I need to update and run the HypriotOS integration tests, and I also have minor issues with a few of the regular tests around
/etc/os-release. Second, I need to build
docker-machine for aarch64. And I need to get my hands on a more recent kernel - the only version available for the Odroid out-of-the-box is 3.14.79 these days.