OpenWrt Forum Archive

Topic: Run Docker containers on OpenWrt?

The content of this topic has been archived between 11 Apr 2018 and 30 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Just wondering if anyone is still pursuing this?

I am still awaiting from NodeGuy's response. Perhaps, this Building OpenWRT on Docker discussion thread will be useful for you to get started.

(Last edited by mazilo on 16 Apr 2015, 14:53)

To this date, I still have no idea why I would need docker. Does it natively run on a device flashed with an OpenWRT firmware? If so, what can it do?

I love this idea, because I want to run docker inside my openwrt router. it will simplify lots of configuration works.

I also interesting in trying Docker on OpenWRT if this will be possible.

There is already solution for LXC if anyone want to give it a try: https://forum.openwrt.org/viewtopic.php … 64#p275064

(Last edited by RussianNeuroMancer on 29 Sep 2015, 13:03)

zixia wrote:

I love this idea, because I want to run docker inside my openwrt router. it will simplify lots of configuration works.

I just can't perceive how this will be possible. Care to elaborate with some examples?

Has there been any progress on this?
I'm trying to get an instance of docker running on openWRT myself.
So far I've tried to run a prebuilt Docker on my ARM Platform.

An attemp to run "dockerd &" gave me:

root@lede:~# WARN[0000] could not change group /var/run/docker.sock to docker: group docker not found
    INFO[0000] libcontainerd: new containerd process, pid: 2902
    WARN[0000] containerd: low RLIMIT_NOFILE changing to max  current=1024 max=4096
    WARN[0001] unable to modify root key limit, number of containers could be limited by this quota: open /proc/sys/kernel/keys/root_maxkeys: no such file or directory
    Error starting daemon: error while opening volume store metadata database: madvise: function not implemented

this doesn't look too bad, right?
The Docker Installation guide points out that I need to have "a properly mounted cgroupfs hierarchy"
As my error output says something about groups, my guess is that I need to set up a cgroup hierarchy.

This is made possible on Chaos Calmer built for x86-64 platform, however building from source code is required.

First add these to targets/linux/x86/config-3.18(i don't remember the actual path but seems so):

CONFIG_ADVISE_SYSCALLS=y
CONFIG_KEYS=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
CONFIG_KEYS_DEBUG_PROC_KEYS=y
CONFIG_AUDIT=y
CONFIG_AUDITSYSCALL=y
CONFIG_SCHED_AUTOGROUP=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_PROC_KCORE=y
CONFIG_JFFS2_FS_POSIX_ACL=y
CONFIG_JFFS2_FS_SECURITY=y
CONFIG_X86_DECODER_SELFTEST=y

Then in Global Build settings select everything related to namespace, cgroup and lxc, select kmod-veth in Network Support, select everything related to ebtables(just use search) and kmod-nf-nathelper kmod-nf-nathelper-extra in Netfilter Extensions.

Also select iptables-mod-conntrack-extra iptables-mod-extra iptables-mod-ipsec iptables-mod-nat-extra in iptables, and procps xz-utils in Utiltites.

Start the build now and you'll get what you want.

I'm not allowed to post image or links here, if possible I'm willing to share my prebuilt image and buildroot environment(a docker image).

yichya wrote:

I'm not allowed to post image or links here, if possible I'm willing to share my prebuilt image and buildroot environment(a docker image).

Use link shorter and post link with spaces, just like this:
bit. ly /2ifHGW8

hmm, can somebody tell me a good reason/good example to install docker on an OpenWRT router?

here is my full kernel config that I used to get it running: bit. ly /2wIvKSs

@rj-45
We're using it for research in the field of edge computing.
We use docker swarm as a cloud computing platform and the router would be one possible processing node for a task/application that is being deployed to the swarm. The router has the unique characteristic that it has a 0 hop distance to the user (-> low latency). So the router might be the best node in the swarm to run a computationally light task for the user.

how about a swarm of raspberry pies? More power and space and a more stable implemantation of docker.

Yes, actually we switched to using a raspberry for our tests. Using the router was sort of a proof of concept. As routers are fairly ubiquitous in the environment they form an attractive platform for the deployment of edge computing services. Another reason to explore routers/Wifi-APs as an edge computing platform is, that they have unique contextual knowledge of theire end-devices (e.g., proximity, channel characteristics) which can be useful for applications. Also you can have applications create theire own Wifi-Network with custom SSID. This would allow for networked devices to be shipped preconfigured on that custom SSID and be operational out of the box.

maxfuchs wrote:

unique contextual knowledge of theire end-devices (e.g., proximity, channel characteristics) which can be useful for applications.

Which applications do you have in mind?

Also you can have applications create theire own Wifi-Network with custom SSID.

Where is the requierement for docker?

This would allow for networked devices to be shipped preconfigured on that custom SSID and be operational out of the box.


I don't understand. What is the difference to a openwrt installation without docker?

Which applications do you have in mind?
E.g. I implemented a smart desktop lamp which used the currently connected devices in the network as a feature. If my ereader was connected (which it is only when in use) this would give the lamp a hint that it should turn on. I didn't use docker to broadcast that information to the lamp.

Where is the requierement for docker?
I gave these arguments to support the idea of using the Router as a computing platform in general. Not related to docker.

The benefit of using docker is that it makes the provisioning of applications across different routers/servers/Raspberrys easy. Think of a mobile user. He may run his application on different routers as he moves through the city. Those routers might all be part of a docker swarm, and we can dynamically move the application in form of a container between the routers.

The discussion might have continued from here.