diff --git a/docs/kernels.md b/docs/kernels.md index bc0f3568b..b3b16f33c 100644 --- a/docs/kernels.md +++ b/docs/kernels.md @@ -38,6 +38,15 @@ In summary, LinuxKit offers a choice of the following kernels: - [linuxkit/kernel-fedora](https://hub.docker.com/r/linuxkit/kernel-fedora/): Selected Fedora kernels. +## Loading kernel modules + +Most kernel modules are autoloaded with `mdev` but if you need to `modprobe` a module manually you can use the `modprobe` package in the `onboot` section like this: +``` + - name: modprobe + image: linuxkit/modprobe: + command: ["modprobe", "-a", "iscsi_tcp", "dm_multipath"] +``` + ## Compiling external kernel modules This section describes how to build external (out-of-tree) kernel diff --git a/pkg/modprobe/Dockerfile b/pkg/modprobe/Dockerfile new file mode 100644 index 000000000..6a8a9a089 --- /dev/null +++ b/pkg/modprobe/Dockerfile @@ -0,0 +1,13 @@ +FROM linuxkit/alpine:87a0cd10449d72f374f950004467737dbf440630 AS mirror + +RUN mkdir -p /out/etc/apk && cp -r /etc/apk/* /out/etc/apk/ +RUN apk add --no-cache --initdb -p /out \ + busybox +RUN rm -rf /out/etc/apk /out/lib/apk /out/var/cache + +FROM scratch +ENTRYPOINT [] +CMD [] +WORKDIR / +COPY --from=mirror /out/ / +LABEL org.mobyproject.config='{"binds": ["/lib/modules:/lib/modules", "/sys:/sys"], "capabilities": ["CAP_SYS_MODULE"]}' diff --git a/pkg/modprobe/Makefile b/pkg/modprobe/Makefile new file mode 100644 index 000000000..c591652b6 --- /dev/null +++ b/pkg/modprobe/Makefile @@ -0,0 +1,3 @@ +IMAGE=modprobe + +include ../package.mk