Get Docker running on Khadas VIM

Yes I know, but this is the easy part. The harder part is building a custom kernel with aufs support and other necessary kernel options (if you cannot go for mainline). Igor pays much attention to shipping Armbian images with Docker ready kernels.

1 Like

I’ve fixed the compilation issues and enabled the brcm* drivers again.
How do I enable the build-in wifi module (bt already runs fine)?

  • Which kernel module do i have load?
  • Do I need special firmware blobs?
  • Do I have to initialize the HW in a particular way?
1 Like

All the latest images Armbian for Amlogic S9xxx, at the core of everything is already enabled for Docker. You only need to install “docker.io” the system by regular means (through synaptic or apt-get).

Hi Oleg,

at this time the ODROID-C2 is the only S905 board officially supported by the the Armbian team (and HK has added Docker support to their kernel tree). The Armbian build toolset is quite versatile, so with sources for u-boot and kernel it’s quite easy to build ready to use images for other boards. As your image is build out of tree, please point me to the source you’ve taken to build the kernel (and additional patches, if present). If you have used https://github.com/khadas/linux the Docker service won’t start, although you will be able to install the package.

Cheers
Uli

Hi Gouwa,

I’ve updated the PR.

Cheers
Uli

Hi Oleg,

did you manage to build a mainline kernel for the KVIM?

Cheers
Uli

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.

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] https://download.docker.com/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.