Skip to content

Modprobe idea #18

Closed
Closed
@andyneff

Description

@andyneff

I found a trick you could optionally include in (maybe your more advanced?) documentation. There is a way to make a docker container run modprobe for you

Dockerfile (image with modprobe in it)

FROM fedora:29

SHELL ["/usr/bin/env", "bash", "-euxvc"]

RUN dnf install -y kmod; \
    rm -rf /var/cache/yum/*

docker-compose.yml

version: '2.3'
services:
  modprobe:
    image: modprobe
    build:
      context: .
    volumes:
      - type: bind
        source: /lib/modules
        target: /lib/modules
        read_only: true
    restart: "no"
    command: bash -euc 'modprobe nfsd; modprobe nfs'
    cap_add:
      - SYS_MODULE

Now you just make your nfs container server depend on that modprobe (maybe you'll have to add a wait routine instead of a check and fail on the lsmod check for nfs and nfsd?) and now you have a container that you can keep running through reboots.

You can of course combine these two into one container instead of two, but I don't know how universal this is (for example using a debian image on fedora, but I suspect that'll work)

Note for the modprobe, you only need SYS_MODULE capability

Base on https://dummdida.tumblr.com/post/117157045170/modprobe-in-a-docker-container


Thank for the awesome image!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions