It appears that device mapper support has not been compiled into the kernel being used for Docker for Mac. I noticed this because it broke a number of my containers that I use to build disk images and rely on being able to use kpartx to mount partitions inside disk image files. These build containers work just fine on boot2docker and the inability to use tools like kpartx that use the device-mapper breaks this important use case for me.
Can we get device-mapper support included in the Docker for Mac custom kernel?
Expected behavior
Tools that use device-mapper such as kpartx should function correctly from containers running on Docker for Mac. A simple check for device-mapper support indicates kernel support:
# dmsetup ls
No devices found
Actual behavior
Device-mapper support does not appear to be built into the Docker for Mac kernel which renders such useful tools as kpartx non-functional. The same check from above sadly fails:
# dmsetup ls
/dev/mapper/control: open failed: No such device
Failure to communicate with kernel device-mapper driver.
Check that device-mapper is available in the kernel.
Incompatible libdevmapper (unknown version) and kernel driver (unknown version).
Command failed
Information
$ pinata diagnose -u
OS X: version 10.11.4 (build: 15E65)
Docker.app: version v1.11.1-beta11
Running diagnostic tests:
[OK] docker-cli
[OK] Moby booted
[OK] driver.amd64-linux
[OK] vmnetd
[OK] osxfs
[OK] db
[OK] slirp
[OK] menubar
[OK] environment
[OK] Docker
[OK] VT-x
Docker logs are being collected into /tmp/20160516-090522.tar.gz
Most specific failure is: No error was detected
Your unique id is: 39F41E0E-DF04-4A98-A7B2-0727884ECF08
Please quote this in all correspondence.
OSX 10.11.4
Steps to reproduce the behavior
- Run an alpine container and install device-mapper.
$ docker run --rm -it --privileged alpine sh
# apk update
# apk add device-mapper
(1/1) Installing device-mapper (2.02.138-r0)
Executing busybox-1.24.1-r7.trigger
OK: 5 MiB in 12 packages
- List devices with dmsetup and observe the failure condition.
# dmsetup ls
/dev/mapper/control: open failed: No such device
Failure to communicate with kernel device-mapper driver.
Check that device-mapper is available in the kernel.
Incompatible libdevmapper (unknown version) and kernel driver (unknown version).
Command failed
This also fails when directly run on the Docker for Mac VM:
moby:~# dmsetup ls
/dev/mapper/control: open failed: No such device
Failure to communicate with kernel device-mapper driver.
Check that device-mapper is available in the kernel.
Incompatible libdevmapper (unknown version) and kernel driver (unknown version).
Command failed
The expected behavior should be as per boot2docker:
# dmsetup ls
No devices found