Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modprobe idea #18

Closed
andyneff opened this issue Jan 31, 2019 · 1 comment
Closed

Modprobe idea #18

andyneff opened this issue Jan 31, 2019 · 1 comment

Comments

@andyneff
Copy link

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!

@ehough
Copy link
Owner

ehough commented Jan 31, 2019

That is an outrageously clever idea! Thanks for sharing it. At a minimum, I'm going to add this to the advanced docs, but I think it could be incorporated into entrypoint.sh (assuming the user gives the container SYS_MODULE).

Of course, I'll credit you for the idea. Thanks again!

@ehough ehough closed this as completed in 9d87648 Jan 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants