Get Docker running on Khadas VIM

For assembling the images Armbian I use my own modification of the kernel source. This “hybrid” mod, in which I gradually want to collect all the useful branches of HK Amlogic, LE, VIM, etc.

https://github.com/150balbes/Amlogic_s905-kernel/tree/armbian

PS. note that my builds are not official.

pp. ss.
Note that the configuration for the build of this kernel is here.

https://github.com/150balbes/lib/blob/master/config/kernel/linux-amlogics905x-default.config

1 Like

Do you know how to check, if a kernel config meets the Docker requirements?
Here are the results for the config mentioned above:

ubuntu@kvim:~/kernel/3.14$ bash check-config.sh linux-amlogics905x-default.config
info: reading kernel config from linux-amlogics905x-default.config ...

Generally Necessary:
- cgroup hierarchy: properly mounted [/sys/fs/cgroup]
- apparmor: enabled and tools installed
- CONFIG_NAMESPACES: enabled
- CONFIG_NET_NS: enabled
- CONFIG_PID_NS: enabled
- CONFIG_IPC_NS: enabled
- CONFIG_UTS_NS: enabled
- CONFIG_CGROUPS: enabled
- CONFIG_CGROUP_CPUACCT: enabled
- CONFIG_CGROUP_DEVICE: enabled
- CONFIG_CGROUP_FREEZER: enabled
- CONFIG_CGROUP_SCHED: enabled
- CONFIG_CPUSETS: enabled
- CONFIG_MEMCG: enabled
- CONFIG_KEYS: enabled
- CONFIG_VETH: enabled (as module)
- CONFIG_BRIDGE: enabled
- CONFIG_BRIDGE_NETFILTER: enabled
- CONFIG_NF_NAT_IPV4: enabled
- CONFIG_IP_NF_FILTER: enabled
- CONFIG_IP_NF_TARGET_MASQUERADE: enabled
- CONFIG_NETFILTER_XT_MATCH_ADDRTYPE: enabled (as module)
- CONFIG_NETFILTER_XT_MATCH_CONNTRACK: enabled
- CONFIG_NETFILTER_XT_MATCH_IPVS: missing
- CONFIG_IP_NF_NAT: missing
- CONFIG_NF_NAT: enabled
- CONFIG_NF_NAT_NEEDED: enabled
- CONFIG_POSIX_MQUEUE: enabled
- CONFIG_DEVPTS_MULTIPLE_INSTANCES: enabled

Optional Features:
- CONFIG_USER_NS: enabled
- CONFIG_SECCOMP: missing
- CONFIG_CGROUP_PIDS: missing
- CONFIG_MEMCG_SWAP: enabled
- CONFIG_MEMCG_SWAP_ENABLED: enabled
- CONFIG_MEMCG_KMEM: enabled
- CONFIG_RESOURCE_COUNTERS: enabled
- CONFIG_BLK_CGROUP: enabled
- CONFIG_BLK_DEV_THROTTLING: enabled
- CONFIG_IOSCHED_CFQ: enabled
- CONFIG_CFQ_GROUP_IOSCHED: missing
- CONFIG_CGROUP_PERF: enabled
- CONFIG_CGROUP_HUGETLB: missing
- CONFIG_NET_CLS_CGROUP: missing
- CONFIG_CGROUP_NET_PRIO: missing
- CONFIG_CFS_BANDWIDTH: missing
- CONFIG_FAIR_GROUP_SCHED: enabled
- CONFIG_RT_GROUP_SCHED: missing
- CONFIG_IP_VS: missing
- CONFIG_IP_VS_NFCT: missing
- CONFIG_IP_VS_RR: missing
- CONFIG_EXT3_FS: missing
- CONFIG_EXT3_FS_XATTR: missing
- CONFIG_EXT3_FS_POSIX_ACL: missing
- CONFIG_EXT3_FS_SECURITY: missing
    (enable these ext3 configs if you are using ext3 as backing filesystem)
- CONFIG_EXT4_FS: enabled
- CONFIG_EXT4_FS_POSIX_ACL: enabled
- CONFIG_EXT4_FS_SECURITY: enabled
- Network Drivers:
  - "overlay":
    - CONFIG_VXLAN: enabled (as module)
      Optional (for encrypted networks):
      - CONFIG_CRYPTO: enabled
      - CONFIG_CRYPTO_AEAD: enabled
      - CONFIG_CRYPTO_GCM: enabled (as module)
      - CONFIG_CRYPTO_SEQIV: enabled
      - CONFIG_CRYPTO_GHASH: enabled (as module)
      - CONFIG_XFRM: enabled
      - CONFIG_XFRM_USER: enabled
      - CONFIG_XFRM_ALGO: enabled
      - CONFIG_INET_ESP: enabled
      - CONFIG_INET_XFRM_MODE_TRANSPORT: enabled
  - "ipvlan":
    - CONFIG_IPVLAN: missing
  - "macvlan":
    - CONFIG_MACVLAN: enabled (as module)
    - CONFIG_DUMMY: enabled (as module)
  - "ftp,tftp client in container":
    - CONFIG_NF_NAT_FTP: enabled
    - CONFIG_NF_CONNTRACK_FTP: enabled
    - CONFIG_NF_NAT_TFTP: enabled
    - CONFIG_NF_CONNTRACK_TFTP: enabled
- Storage Drivers:
  - "aufs":
    - CONFIG_AUFS_FS: missing
      (note that some kernels include AUFS patches but not the AUFS_FS flag)
  - "btrfs":
    - CONFIG_BTRFS_FS: enabled
    - CONFIG_BTRFS_FS_POSIX_ACL: enabled
  - "devicemapper":
    - CONFIG_BLK_DEV_DM: enabled (as module)
    - CONFIG_DM_THIN_PROVISIONING: enabled (as module)
  - "overlay":
    - CONFIG_OVERLAY_FS: enabled
  - "zfs":
    - /dev/zfs: missing
    - zfs command: missing
    - zpool command: missing

Limits:
- /proc/sys/kernel/keys/root_maxkeys: 1000000

This is for curiosity only. Sometimes you find some Docker images for armhf but not their equivalent for aarch64.

Martin and his team has already get linux-4.1x running on the Khadas VIM now, and Khadas VIM is excepted to be added in to the support list of linux-v4.12. check this for the information.

1 Like

Hi, @umiddelb:
Can you help to figure out the problem I met? I got the error when run docker pull:

root@Khadas:~# docker pull hello-world
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/library/hello-world/manifests/latest: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fhello-world%3Apull&service=registry.docker.io: read tcp 192.168.1.134:55525->50.17.62.194:443: read: connection reset by peer
root@Khadas:~# 

Following are my steps to build Docker on VIM:
1) Merge the pull require you created for linux kernel
2) Build new Ubuntu-mate-16.04 ROM
3) Install docker.io:

# apt-get install lxc aufs-tools cgroup-lite apparmor docker.io

Docker info:

khadas@Khadas:~$ sudo docker info
[sudo] password for khadas: 
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 1.12.6
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 0
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: null host bridge overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: apparmor seccomp
Kernel Version: 3.14.29
Operating System: Ubuntu 16.04.2 LTS
OSType: linux
Architecture: aarch64
CPUs: 4
Total Memory: 1.766 GiB
Name: Khadas
ID: QQ6E:ZD5I:5TLE:UDUA:XGJ5:MGSQ:HQOP:U2XX:22FD:AKH4:LXCJ:UECW
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Insecure Registries:
 127.0.0.0/8
khadas@Khadas:~$

I’m not quite familiar with Docker :wink:
Thanks!

Hm,

this is strange, although the hello-world example cannot be executed on ARM since its made for X86 the Docker pull should succeed in any case.

  1. Make sure that /sys/fs/cgroup is mounted correctly (or just reboot)

  2. Start Docker Daemon in debug mode

sudo systemctl stop docker
sudo dockerd -D
  1. Repeat the Docker pull request in a different console window

Is docker support included into newest Ubuntu server image? Could you give me the steps to install docker on Vim running that image?

I’ve also tried to run Docker on Armbian but without luck. Docker daemon doesn’t start after installing docker.io. I’ve tried few fixes found on the web but nothing worked so far. Can someone provide step-by-step guide to run docker for any image on Vim?

1 Like

Checked on the last image Armbian Ubuntu Mate. Install docker.io with all dependencies. Performed in the terminal version request and installation of the unit. Everything works.

https://yadi.sk/i/MqX5q4jR3JH4et

https://yadi.sk/i/CUnxWYIz3JH4f7

https://yadi.sk/i/PMC6xWYi3JH4fF

1 Like

Thanks for checking balbes150. The problems I’ve got was Khadas build of Armbian installed on eMMC. I’ll try with your latest image today or tomorrow and I’ll try to provide more info about the problems I have with eMMC installation.

The first question is still valid though - is docker support included into the newest Ubuntu server image?

1 Like

Ubuntu (like CentOS, Fedora or Debian) has Docker support included (from the userland perspective). The most crucial part getting Docker up and running is to build a Docker enabling kernel. Typically ARM boards a shipped with a BSP kernel from the SoC vendor (usually derived from the Android-kernel), In this case here it’s a 3.14 kernel which I have patched to include aufs Support, but other requirements might miss (and won’t never be added in 3.14) in order to make use of the latest Docker feature. Since you’re not interested in using a DE, a mainline kernel might be fine for you. Then you should expect Docker to run flawlessly.

You might provide some more information about your issue, e.g. which image, which kernel, which error message and which console output when starting the Docker daemon manually (see my post from March/11 in this thread here).

2 Likes

Finally I was able to perform some more detailed tests. First of all I’m new to Linux and docker and for sure I’m confusing a lot of stuff here.
The first confusion comes with how to install docker. I found 2 ways on the web.

  • simply running apt-get install docker.io which is supposed to work on Ubuntu out of the box
  • following these crazy instructions: Install Docker Engine on Ubuntu | Docker Docs, which I have doubts if it’s a valid way for ARM infrastructure.
    If you guys could comment on that, I’d be super happy.

Now the problems I’m facing. I’m trying to do this on Vim Pro.


Running Vim_Ubuntu-server-16.04_V170515 image. When trying to install docker.io I’m getting this:

loku@Khadas:~$ sudo apt-get install docker.io
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package docker.io
E: Couldn’t find any package by glob ‘docker.io
E: Couldn’t find any package by regex ‘docker.io

When following official steps mentioned before (do after adding docker repo and so on) and finally installing docker-ce, I’m getting this:

loku@Khadas:~$ sudo apt-get install docker-ce
[sudo] password for loku:
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package docker-ce


Running Vim_Ubuntu-16.04_V170124 from this thread: http://forum.khadas.com/t/ubuntu-rom-upgraded-on-emmc.
While installing docker.io, process hangs after printing those lines:

loku@Khadas:~$ sudo apt-get install docker.io
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
containerd iptables runc
Suggested packages:
aufs-tools debootstrap docker-doc rinse zfs-fuse | zfsutils
Recommended packages:
cgroupfs-mount | cgroup-lite ubuntu-fan apparmor
The following NEW packages will be installed:
containerd docker.io iptables runc
0 upgraded, 4 newly installed, 0 to remove and 198 not upgraded.
Need to get 14.1 MB of archives.
After this operation, 82.1 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ports.ubuntu.com xenial/main arm64 iptables arm64 1.6.0-2ubuntu3 [2 37 kB]
Get:2 http://ports.ubuntu.com xenial-updates/universe arm64 runc arm64 1.0.0~rc2 -0ubuntu2~16.04.1 [1,270 kB]
Get:3 http://ports.ubuntu.com xenial-updates/universe arm64 containerd arm64 0.2 .5-0ubuntu1~16.04.1 [3,397 kB]
Get:4 http://ports.ubuntu.com xenial-updates/universe arm64 docker.io arm64 1.12 .6-0ubuntu1~16.04.1 [9,223 kB]
Fetched 14.1 MB in 10s (1,354 kB/s)
Selecting previously unselected package iptables.
(Reading database … 133607 files and directories currently installed.)
Preparing to unpack …/iptables_1.6.0-2ubuntu3_arm64.deb …
Unpacking iptables (1.6.0-2ubuntu3) …
Selecting previously unselected package runc.
Preparing to unpack …/runc_1.0.0~rc2-0ubuntu2~16.04.1_arm64.deb …
Unpacking runc (1.0.0~rc2-0ubuntu2~16.04.1) …
Selecting previously unselected package containerd.
Preparing to unpack …/containerd_0.2.5-0ubuntu1~16.04.1_arm64.deb …
Unpacking containerd (0.2.5-0ubuntu1~16.04.1) …
Selecting previously unselected package docker.io.
Preparing to unpack …/docker.io_1.12.6-0ubuntu1~16.04.1_arm64.deb …
Unpacking docker.io (1.12.6-0ubuntu1~16.04.1) …
Processing triggers for libc-bin (2.23-0ubuntu5) …
Processing triggers for man-db (2.7.5-1) …
Processing triggers for systemd (229-4ubuntu13) …
Processing triggers for ureadahead (0.100.0-19) …
Setting up iptables (1.6.0-2ubuntu3) …
Setting up runc (1.0.0~rc2-0ubuntu2~16.04.1) …
Setting up containerd (0.2.5-0ubuntu1~16.04.1) …
Setting up docker.io (1.12.6-0ubuntu1~16.04.1) …
Adding group `docker’ (GID 118) …
Done.

When I interrupt it and try again, I get this:

loku@Khadas:~$ sudo apt-get install docker.io
E: dpkg was interrupted, you must manually run ‘sudo dpkg --configure -a’ to correct the problem.

When I try suggested command, it hangs again after printing this:

loku@Khadas:~$ sudo dpkg --configure -a
Setting up docker.io (1.12.6-0ubuntu1~16.04.1) …
addgroup: The group `docker’ already exists as a system group. Exiting.


I haven’t yet time to deeply check the newest Armbian image which goes to SD card but from what I remember I manage to install with the official docker steps for Ubuntu but specifying this as a docker repo:

“deb [arch=armhf] Index of linux/ubuntu/ $(lsb_release -cs) stable”

Which is not the correct architecture I believe.

So as you can see I’m quite confused with my trials and don’t know what I’m actually doing so I’d be super happy if you guys can explain me what mistakes I’m doing :wink: If there are some ways I can provide more information, please let me know.
Thanks in advance.

Which kernel are you using?

Do you get some console messages during the ‘hangs’? If Docker uses (for whatever reason) device-mapper as storage backend, it will take some time until the initialisation has finished (especially on uSD storage).

Honestly, I’m not using any of the images. Instead I’m using my own scripts (composing firmware, kernel and ubuntu base) to set-up my minimal ubuntu server environment.

The official (Vim_Ubuntu-server-16.04_V170515) and Armbian image I was using runs kernel 3.14.29. I believe unofficial (Vim_Ubuntu-16.04_V170124) image runs the same as it was released few days after the Armbian image and it was supposed to be just rebuilt by Khadas team (for the moment I have no possibility to reflash to check the kernel version). I’ve used

uname -r

to determine kernel version.
If the logs you’re asking about is just console output then nothing was happening for almost an hour, then I interrupted the command. No output was printed within this time. If there is any other place I can read more logs, please let me know. I’m a developer but completely new to Linux.
If you’d like to share your scripts for minimal Ubintu setup, I’d be willing to try. Honestly I just need any setup for Docker that I can play and learn with.
Thanks.

Use the first installation option (via the command apt install docker.io). This command will install the current version from the repository for aarch64 (ARMv8). In the second version of the manual describes how to install the old architecture armhf (ARMv7). As far as I know, the version of Docker for aarch64 can execute data\images created for both versions of ARMv8 (64-bit) and ARMv7 (32-bit). Version armfh can only run the old version ARMv7 (32-bit).

Check the connection of the network repositories. You can see how they are spelled out in Armbian and copy them into version firmware with the official server (perhaps when you transfer they were lost or changed).

You cannot interrupt the installation until it is completed. At this time there is a system setting and set permissions for groups. If you interrupt, the system obtained is not a specific state and cannot be used to re-install without fully removing the previous installation.

So today I’ve performed those steps on the newest official Ubintu server image.
I’ve updated /etc/apt/sources.list file which seems to contain repository urls to the same I have in SD Armbian (which is able to find docker.io). The list is as following:

loku@Khadas:~$ cat /etc/apt/sources.list
deb http://ports.ubuntu.com/ xenial main restricted universe multiverse
deb http://ports.ubuntu.com/ xenial-security main restricted universe multiverse
deb http://ports.ubuntu.com/ xenial-updates main restricted universe multiverse
deb http://ports.ubuntu.com/ xenial-backports main restricted universe multiverse
deb http://apt.armbian.com xenial main utils xenial-desktop

After that I’ve run:

sudo apt-get update
sudo apt-get install docker.io

It works in a way that it’s able to find the package and starts installing it but the thing seems to hang in the same place as in eMMC Armbian image. I’ll leave it like this for the night.
What’s worrying me is that this hang does not happening when I try the same on SD Armbian image I have. Installation goes smoothly. Docker daemon seems having problems to start but that’s probably a different story). Will let you know tomorrow. If there’s any way I can check what’s going on during the hang or why it’s hanging please let me know.

In the worst case I could continue my experiments on SD Armbian image but would prefer to get any eMMC image to run docker.

Thank you guys for helping me so far.

1 Like

Try copying from the SD card BOOT partition contents to the /boot directory on the eMMC (after installation). Possible when installing occurs by mistake Initrd (this is a guess, I have not tested it).

Just for sake of completeness - I’ve checked in the morning and docker installation was stuck in the same place. Interrupting and trying to install again, or running for example docker ps hangs the console and I don’t know how to get some more logs to know what’s going on.
@balbes150: I’ll try your solution today. Do you mean copying BOOT partition content from Armbian SD card to /boot directory on eMMC with official Khadas Ubuntu installed?

File copying applies only to version Armbian (if you check it in eMMC).

Before I try this, I’ve discovered another useful Linux command:

ps faux | less

I’ve run it while the docker.io installation is hanging and got this:

It looks like the process is waiting for the password but it doesn’t ask for it in the console. Do you know how can I get around that?

1 Like

with debian jessie/stretch you only get armhf docker images to run, install ubuntu xenial.

  • activate multiboot: android settings, update from sd aml_autoscript.zip
  • write image to sd card, copy kvim.dbt to root and rename to dbt.img

Armbian_5.27_S9xxx_Ubuntu_xenial_3.14.29_server_20170625.img

sudo apt-get install docker.io

sudo groupadd docker
sudo usermod -aG docker $USER
sudo systemctl enable docker

docker run arm64v8/hello-world

docker search arm64
docker search armhf

docker -v
Docker version 1.12.6, build 78d1802

2 Likes