Staying up-to-date with Docker on a Pi

If you're like me, you want to stay current with Docker. Maybe you're looking to use the new features as they come out, maybe you're just wanting compatibility between the various platforms you use. Unfortunately, Docker does not create official packages for the Pi, and other public sources update infrequently. What a pain!

Building it yourself is frustrating, too. The Docker build process requires Docker, and the version included with raspbian (and debian jessie) is too old to use for the process. You can get around this by installing one of those infrequently updated but much newer than the default repo packages, and then on to the next item. Building Docker requires more memory than the Pi has! You'll need a sizable swap file (or partition) and to adjust swappiness (sysctl vm.swappiness=70) and go from there.

The instructions go roughly like this:

. If you don't have a swap partition, create a swap file. sudo dd if=/dev/zero bs-=1M count=512 of=/swapfile && sudo mkswap /swapfile && sudo swapon /swapfile

. Raise the swappieness parameter: sudo sysctl vm.swappiness=70

. Install prerequisites: sudo apt-get install build-essential git

. Install a relatively recent Docker package, either the one I provide below, or you can get one from http://blog.hypriot.com/downloads/

. You will surely need to change your storage driver to overlay (or if you're using docker 1.12 or above, overlay2). Edit /lib/systemd/system/docker.service and change ExecStart to ExecStart=/usr/bin/dockerd -H fd:// --storage-driver=overlay2

. Download the Docker git tree: git clone https://github.com/docker/docker.git && cd docker

. Begin the build process: make deb

. Go get lunch, In another city.

. Provided no issues popped up during the build, you'll find your new package in bundles/latest/build-deb/debian-jessie/

. Before you install your newly built package, you should remove the old one you used to build. If you used my package: sudo apt-get remove docker-engine && sudo dpkg -P docker-engine

. If you used the Hypriot package, sudo apt-get remove docker-hypriot && sudo dpkg -P docker-hypriot

. You should also remove the previous Docker data, or you'll get errors with old modules: sudo rm -rf /var/lib/docker

. Now you can install the newly created package: sudo dpkg -i bundles/latest/build-deb/debian-jessie/docker-engine*deb

If you'd like to use my Docker package, I've made it available here: https://brokedown.net/docker-engine_1.12.0~dev~git20160726.003227.0.a4634cd-0~jessie_armhf.deb md5sum: 4e446917dbd59155c0dd4719e201000a

Happy Dockering!