Skip to content

Document DinD modprobe gotcha #86

Closed

Description

@Beanow

Normally the docker daemon runs modprobe for us to include it's dependencies in the kernel.
However DinD can't currently modprobe and outputs:
modprobe: can't change directory to '/lib/modules': No such file or directory

When using different drivers that would have worked on the host, we need to manually modprobe them ahead of time on the host. Especially because this is different from your normal docker experience it's worth documenting this behavior and the workarounds.

Working setup

  • Freshly booted
  • Host storage driver: aufs
  • DinD storage driver: aufs

Host modprobes aufs for us, so DinD automagically runs without issues.

Unexpected error

  • Freshly booted
  • Host storage driver: zfs
  • DinD storage driver: aufs
$ docker run --rm -ti --privileged docker:dind dockerd -s aufs
...
Error starting daemon: error initializing graphdriver: driver not supported

Fixing it

  • Freshly booted
  • Host storage driver: zfs
  • DinD storage driver: aufs
$ sudo modprobe aufs
$ docker run --rm -ti --privileged docker:dind dockerd -s aufs
...
INFO[2017-10-13T15:04:10.504077742Z] Daemon has completed initialization          
INFO[2017-10-13T15:04:10.669436504Z] API listen on /var/run/docker.sock 

Permanent solution

(For Ubuntu)

$ echo aufs | sudo tee /etc/modules-load.d/dind.conf
  • Freshly booted
  • Host storage driver: zfs
  • DinD storage driver: aufs
$ docker run --rm -ti --privileged docker:dind dockerd -s aufs
...
INFO[2017-10-13T15:27:00.870223217Z] Docker daemon    commit=afdb6d4 graphdriver(s)=aufs version=17.09.0-ce
INFO[2017-10-13T15:27:00.870565793Z] Daemon has completed initialization          
INFO[2017-10-13T15:27:00.953295479Z] API listen on /var/run/docker.sock     

Activity

  1. yosifkit commented on Oct 13, 2017

    @yosifkit
    Member

    While @tianon's magic modprobe from the container is nice, I feel like this is really covered in the Docs:

    IMPORTANT: this image defaults to --storage-driver=vfs, which will be very slow and inefficient (but is the only driver which is guaranteed to work regardless of your underlying filesystem). Which driver you should use varies depending on your needs, but a good rule of thumb is that your DinD instance should be using the same driver as your host (which can be seen under Storage Driver in the output of docker info). See the "Custom daemon flags" section below for how to specify your storage driver.

  2. Beanow commented on Oct 13, 2017

    @Beanow
    Author

    @yosifkit I see your point, but don't agree. This addresses storage choices. And while that's probably the main reason you'd run into modprobe issues, it doesn't talk about the gotchas surrounding modules which could apply to any driver setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions