[OpenWrt-Devel] running docker on openwrt?

Torbjorn Jansson torbjorn.jansson at mbox200.swipnet.se
Mon Oct 8 05:02:10 EDT 2018

On 2018-10-07 17:00, Daniel Golle wrote:
> On Sun, Oct 07, 2018 at 04:54:42PM +0200, Torbjorn Jansson wrote:
>> On 2018-09-30 16:21, Daniel Golle wrote:
>>> On Sun, Sep 30, 2018 at 02:18:54PM +0200, Torbjorn Jansson wrote:
>>>> On 2018-09-30 13:59, Daniel Golle wrote:
>>>>> On Sun, Sep 30, 2018 at 12:21:12PM +0200, Torbjorn Jansson wrote:
>>>>>> Hello.
>>>>>> a question, is it possible to run docker on openwrt?
>>>>>> reason for asking is that i got a raspberrypi running openwrt and it got
>>>>>> plenty of storage space and is mostly sitting idle so if i can run docker on
>>>>>> it i might be able to consolidate some of the other pis i have for various
>>>>>> purposes.
>>>>>> i know you can do it the other way around, running openwrt in a docker
>>>>>> instance on a regular computer but can you get docker itself to run under
>>>>>> openwrt?
>>>>>> ideas, suggestions?
>>>>> Just use LXC, that works well on OpenWrt, I'm using that to run various
>>>>> containers running Debian and OpenWrt on top of OpenWrt.
>>>>> (but you need to compile it yourself because many of the kernel options
>>>>> needed for containers aren't enabled by default)
>>>>> Docker didn't attract a lot of interest because it is x86_64 and
>>>>> ARM-only, so 80% of OpenWrt-supported devices aren't supported by
>>>>> Docker which doesn't provide images for MIPS-like CPUs.
>>>>> However, now that Golang has been added to the packages feed we could
>>>>> package Docker at least for the platforms supported by it...
>>>> ok, i see.
>>>> i've never tried lxc and i think docker also needs some extra kernel config
>>>> options for it to work.
>>>> i ran the script from:
>>>> https://raw.githubusercontent.com/docker/docker/master/contrib/check-config.sh
>>>> on one of my boxes and it complained about:
>>>> - CONFIG_NAMESPACES: missing
>>>> - CONFIG_NET_NS: missing
>>>> - CONFIG_PID_NS: missing
>>>> - CONFIG_IPC_NS: missing
>>>> - CONFIG_UTS_NS: missing
>>>> - CONFIG_CGROUPS: missing
>>>> - CONFIG_CGROUP_DEVICE: missing
>>>> - CONFIG_CGROUP_SCHED: missing
>>>> - CONFIG_CPUSETS: missing
>>>> - CONFIG_MEMCG: missing
>>>> - CONFIG_POSIX_MQUEUE: missing
>>>> and then there were a bunch of optional features also missing.
>>> For now the binary distribution doesn't have all those kernel features
>>> enabled. You need to compile from source and make sure that
>>> CONFIG_LXC_KERNEL_OPTIONS is set, this selects all the kernel options
>>> needed to run containers.
>> a followup question, where in the "make menuconfig" menu system do i find LXC?
>> i have looked everywhere and it is nowhere to be found.
>> if i add CONFIG_LXC_KERNEL_OPTIONS=y manually to .config and then run "make
>> menuconfig" the LXC option disappears.
>> i can't figure out what (if any) dependencies i have to select first to make
>> it show up.
> you need to install LXC from the packages feed.
> ie.
> ```
> scripts/feeds update packages
> scripts/feeds install lxc
> ```
> should do the trick.

that worked, but i don't understand exactly what i did wrong before because the 
lxc files were already available under: feeds/packages/utils/lxc
so it is not enough for a package to have its files in the structure, they also 
must be "installed" to show up?

i wonder what i did wrong because i know previous tries of building openwrt i 
got all packages built but perhaps i missed something this time.

anyway, i got lxc kernel options built and after a bit of fiddling with other 
packages (iptables "extra" package & kmod for it) i got the basic docker 
hello-world container to work.
so i think i'm going to do a bit more reading regarding packages and see if i 
can get something that works.

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list