Loading Kernel Module in Linux Container running on Mac and native Docker

879 views
Skip to first unread message

Ovanes Markarian

unread,
Jan 31, 2017, 1:11:56 PM1/31/17
to docker-dev
Hi *,

does Docker allow to load Linux kenel modules in a container being executed by native Docker (Version 1.13.1-rc1-beta40 (15241) Channel: beta).

Right now I am trying to run OpenVSwitch in a Ubuntu 14.04 on Mac OS. Starting the service:

$ service openvswitch-switch start
 modprobe
: ERROR: ../libkmod/libkmod.c:556 kmod_search_moddep() could not open moddep file '/lib/modules/4.9.6-moby/modules.dep.bin'
 
* Inserting openvswitch module
 rmmod
: ERROR: Module bridge is builtin.
 
* removing bridge module
 
* /etc/openvswitch/conf.db does not exist
 
* Creating empty database /etc/openvswitch/conf.db
 
* Starting ovsdb-server
 
* Configuring Open vSwitch system IDs
 modprobe
: ERROR: ../libkmod/libkmod.c:556 kmod_search_moddep() could not open moddep file '/lib/modules/4.9.6-moby/modules.dep.bin'
 
* Inserting openvswitch module
 rmmod
: ERROR: Module bridge is builtin.
 
* removing bridge module
 
* Enabling remote OVSDB managers




Which is obvious, as there is no /lib/modules directory in the container. Attaching to docker TTY shows the /lib/modules/4.9.6-moby directory:

$ screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty

/ # ls -l /lib/modules/4.9.6-moby/
total
88
lrwxrwxrwx    
1 root     root            33 Jan 31 18:08 build -> /usr/src/linux-headers-4.9.6-moby
drwxr
-xr-x    3 root     root            60 Jan 28 17:18 kernel
-rw-r--r--    1 root     root            90 Jan 28 17:18 modules.alias
-rw-r--r--    1 root     root            64 Jan 28 17:18 modules.alias.bin
-rw-r--r--    1 root     root         24727 Jan 28 17:18 modules.builtin
-rw-r--r--    1 root     root         28596 Jan 28 17:18 modules.builtin.bin
-rw-r--r--    1 root     root            54 Jan 28 17:18 modules.dep
-rw-r--r--    1 root     root           100 Jan 28 17:18 modules.dep.bin
-rw-r--r--    1 root     root             0 Jan 28 17:18 modules.devname
-rw-r--r--    1 root     root            53 Jan 28 17:18 modules.order
-rw-r--r--    1 root     root            55 Jan 28 17:18 modules.softdep
-rw-r--r--    1 root     root            49 Jan 28 17:18 modules.symbols
-rw-r--r--    1 root     root            12 Jan 28 17:18 modules.symbols.bin




Container is started as:

$ docker run -ti --privileged --rm --cap-add=ALL my-container:latest /bin/bash

I understand that I can probably mount manually the /lib/modules directory, but I wonder if that can be done in a more elegant way...

Thanks,
Ovanes
Reply all
Reply to author
Forward
0 new messages