NanoPi NEO docker with armbian

Is it possible to run docker containers on NanoPi NEO?

Your Linux kernel version 3.4.113-sun8i is not supported for running docker. Please upgrade your kernel to 3.10.0 or newer.

Unfortuntely no, it does not work with the default legacy kernel 3.4.113-sun8i.

Embrace your dark side

Welcome to the dark side [1]:

I wrote this post with Armbian_5.27.170326_Nanopineo_Ubuntu_xenial_dev_4.10.3.img.

Flash the image on a SD-card, and try:

You are on your own now:

Install docker for ubuntu as described in the official documentation [2]:

# Update packages
sudo apt-get update

# Install required packages
# (they should be already installed in the Armbian image)
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

# Add docker GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

# Add docker repository
# (remove the "[arch=amd64]")
sudo add-apt-repository \
   "deb https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

# Update package (again)
sudo apt-get update

# Install docker
sudo apt-get install docker-ce

It will find and download the armhf packages by itself:

[...]
Get:1 http://ports.ubuntu.com xenial/main armhf iptables armhf 1.6.0-2ubuntu3 [238 kB]
Get:2 http://ports.ubuntu.com xenial/main armhf libltdl7 armhf 2.4.6-0.1 [35.4 kB]
Get:3 https://download.docker.com/linux/ubuntu xenial/stable armhf docker-ce armhf 17.03.0~ce-0~ubuntu-xenial [16.5 MB]
Fetched 16.8 MB in 1min 1s (272 kB/s)

Let's start a container:

root@nanopineo:~# sudo docker run -ti --rm debian:jessie-slim
Unable to find image 'debian:jessie-slim' locally
jessie-slim: Pulling from library/debian
e45e882ed798: Pull complete
Digest: sha256:fb22c1cef74071a6cd0145c1f91ca85ba9bd3f8b4d6db8560fe69eb36a175ca3
Status: Downloaded newer image for debian:jessie-slim
standard_init_linux.go:178: exec user process caused "exec format error"

Does not work? That would have been too simple~

You need a container built for arm7. armhf stands for ARM "Hard Float" [3]:

root@nanopineo:~# sudo docker run -ti --rm armhf-debian:jessie bash
Unable to find image 'armhf-debian:jessie' locally
docker: Error response from daemon: repository armhf-debian not found: does not exist or no pull access.
See 'docker run --help'.
root@nanopineo:~# docker pull armv7/armhf-debian
Using default tag: latest
latest: Pulling from armv7/armhf-debian
cc738ad9b216: Pull complete
a3ed95caeb02: Pull complete
Digest: sha256:7c04a67927a012551a19d359f745480ae77afed229eb1ab0eac403b45fbf5f37
Status: Downloaded newer image for armv7/armhf-debian:latest

Does it work now?:

root@nanopineo:~# sudo docker run -ti --rm armv7/armhf-debian:latest bash
root@46e1031fb28b:/# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support/"
BUG_REPORT_URL="https://bugs.debian.org/"
root@46e1031fb28b:/#

Success!