You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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.
@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.
Activity
tianon commentedon Oct 13, 2017
Good point -- it's probably also worth adding something like the following hack in order to just DTRT in many cases: https://github.com/tianon/dockerfiles/blob/f29962219b71baf9424ddf655fae1772eb794093/docker-tianon/modprobe (inspired from https://twitter.com/lucabruno/status/902934379835662336)
yosifkit commentedon Oct 13, 2017
While @tianon's magic
modprobefrom the container is nice, I feel like this is really covered in the Docs:Beanow commentedon Oct 13, 2017
@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.