Running ARM32 Docker on ARM64

People who want to run docker on Aarch64 servers will bump to the following dilemma:

  1. Docker is built with golang
  2. Golang support for ARM64 is arriving in golang 1.5, scheduled to be released in July 2015.

Meanwhile, there are a couple of options

  1. Build docker with git HEAD of golang
    • causes some compile errors due to changes in golang from 1.4
  2. Build docker with gccgo using go frontend of gcc 5.0
  3. Use the Aarch32 compatibility to run 32bit arm docker to run Aarch64 containers
    • This is what this page will outline

Easiest way is get docker for Arm64 is to boot an arm64 kernel with an arm32 userland. Then docker is just apt-get install away. The 32bit docker binary will run fine both arm64 and 32bit arm containers. If you plan to run all your services inside docker (why else would you be installing docker?), it doesn't really matter that the userland outside docker is 32bit.

Installing armhf docker to arm64 system

I you like to do things the hard way, you can install armhf (32bit arm name for ubuntu/debian) docker into a native 64bit system. This is possible with multi-arch. On your arm64 install:

dpkg --add-architecture armhf
apt-get update
apt-get install --no-install-recommends docker.io

...Which will fail. A few packages need fixing:

Build docker for *armhf* and all the rest packages for *arm64* and *armhf*. The you need to put all generated .deb packages to and packages repository, and repository into sources.list file. Now the apt-get install command above should succeed.

Creating images for docker

You can't do docker pull, since all images in official docker repository are X86/X86_64. Actually we can consider that an advantage, since it means we can't get rooted by downloading and using images by random people in the internets. So we create images our self:

sudo debootstrap --arch=armhf --variant=minbase jessie debian-jessie-armhf http://http.debian.net/debian
sudo debootstrap --arch=arm64 --variant=minbase jessie debian-jessie-arm64 http://http.debian.net/debian
sudo debootstrap --arch=armhf --variant=minbase utopic ubuntu-utopic-armhf http://ports.ubuntu.com
sudo debootstrap --arch=arm64 --variant=minbase utopic ubuntu-utopic-arm64 http://ports.ubuntu.com

$ for i in *; do (cd $i; tar -c .|docker import - $i); done

$ docker images
ubuntu-utopic-armhf   latest              94ac703ec56e        30 minutes ago      111.1 MB
ubuntu-utopic-arm64   latest              ef159a274446        30 minutes ago      127.4 MB
debian-jessie-armhf   latest              0f2d6058e5fa        30 minutes ago      136.9 MB
debian-jessie-arm64   latest              1dc2abcc2dff        30 minutes ago      147.3 MB

protips

  • On ubuntu, remove /etc/sysctl.d/10-zeropage.conf or drop the value to 32768 or lower.
  • If building 32bit software, prefix commands with "linux32", ie build with "linux32 ./configure; linux32 make". This will set the correct personality, uname etc.

RikuVoipio/Docker-multiarch (last modified 2015-05-20 13:31:26)