FriendlyARM NanoPi NEO Mainline and docker

FriendlyARM has an image for the NanoPi NEO with mainline linux kernel.

Introduction

Look! There is a 4.11 kernel image packed with Ubuntu 16.04 (see [1]).

Unfortunately, the image does not support docker out-of-the-box, because the kernel was not built with the required options.

Initial error

The flag -D enables debug output. The full error is:

root@NanoPi-NEO:~# /usr/bin/dockerd -D
DEBU[0000] Listener created for HTTP on unix (/var/run/docker.sock)
INFO[0000] libcontainerd: new containerd process, pid: 1507
WARN[0000] containerd: low RLIMIT_NOFILE changing to max  current=1024 max=65536
DEBU[0000] containerd: read past events                  count=0
DEBU[0000] containerd: grpc api on /var/run/docker/libcontainerd/docker-containerd.sock
DEBU[0000] containerd: supervisor running                cpus=4 memory=497 runtime=docker-runc runtimeArgs=[] stateDir="/var/run/docker/libcontainerd/containerd"
DEBU[0001] libcontainerd: containerd health check returned error: rpc error: code = 14 desc = grpc: the connection is unavailable
DEBU[0001] Using default logging driver json-file
DEBU[0001] Golang's threads limit set to 6840
DEBU[0001] [zfs] zfs command is not available: exec: "zfs": executable file not found in $PATH
ERRO[0001] 'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded.
ERRO[0001] 'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded.
DEBU[0001] Using graph driver vfs
DEBU[0001] Max Concurrent Downloads: 3
DEBU[0001] Max Concurrent Uploads: 5
INFO[0002] Graph migration to content-addressability took 0.00 seconds
WARN[0002] Your kernel does not support cgroup memory limit
WARN[0002] Unable to find cpu cgroup in mounts
WARN[0002] Unable to find blkio cgroup in mounts
WARN[0002] Unable to find cpuset cgroup in mounts
WARN[0002] mountpoint for pids not found
DEBU[0002] Cleaning up old mountid : start.
Error starting daemon: Devices cgroup isn't mounted

Many CONFIG_CGROUP_* kernel options are missing, as well as the CONFIG_OVERLAY_FS option.

Check config

There is a very nice script [2] from the Moby project to check a system config for docker compatibility.

./check-config.sh /boot/config-4.11.2-h3

Add missing options and rebuild the kernel

From FriendlyARM wiki page:

$ git clone https://github.com/friendlyarm/linux.git
$ cd linux
$ git checkout sunxi-4.11.y

$ touch .scmversion
$ make sunxi_defconfig ARCH=arm CROSS_COMPILE=arm-linux-
# edit .config here
$ make zImage dtbs ARCH=arm CROSS_COMPILE=arm-linux-

$ cp arch/arm/boot/zImage /media/SD/boot/

When editing the kernel .config file, to enable an option, take:

# CONFIG_OVERLAY_FS is not set

...and turn it into:

CONFIG_OVERLAY_FS=y