Load kernel module from mac os sierra host to a docker container Load kernel module from mac os sierra host to a docker container docker docker

Load kernel module from mac os sierra host to a docker container


I found out that docker for mac runs over an hyperkit VM with alpine to get the linux kernel.

As mentionned by @DanLowe in the comments, we can access this VM using the following command : docker run --rm -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh

The kernel sources used by this VM are available here : https://github.com/linuxkit/linuxkit

I edited the kernel/kernel_config file and set CONFIG_IP_SCTP=y to enable SCTP support in the kernel.

Then I recompiled the kernel and copied my newly compiled kernel file (bzImage) to the docker for mac /Applications/Docker.app/Contents/Resources/moby/vmlinuz64 kernel file.

Restarted docker for mac and...

host>docker run -it debiancontainer>cat /proc/net/protocols protocol size sockets memory press maxhdr slab module cl co di ac io in de sh ss gs se re sp bi br ha uh gp emSCTPv6 1416 1 0 no 0 yes kernel y y y y y y y y y y y y n y y y y y ySCTP 1256 0 0 no 0 yes kernel y y y y y y y y y y y y n y y y y y y

Pull Request here.