Docker Community Forums

Share and learn in the Docker community.

Unable to mount block device to container


(Remonlam) #1

Hi,

Perhaps I’m doing something wrong here, however on a Linux machine it’s possible to mount a block device to a container, this just works fine.

However when I’m trying to do this on OSX with the Docker for Mac, I won’t be able to mount any of the (block) devices to a container.
Perhaps this won’t work because the containers run’s inside a VM, but is there a way to connect a device to the VM, so I’m able to mount the block device to the container?

Thanks!

Expected behavior

Able to mount a (block) device from the local machine to a container
Something like; docker run -it --device=/dev/diskX:/dev/sdX cents bash

Actual behavior

It won’t mount a local (block) device to a container, perhaps because it’s running inside a vm.

Steps to reproduce the behavior

Run it on a native Linux machine and I’m able to mount the device to the container.
docker run -it --device=/dev/sdX:/dev/sdX centos bash


(Bruno Bronosky) #2

I would love to know what ever came of this.


(Remonlam) #3

Yes well me to :smiley:
My workaround, unfortunately still is to use a Linux machine, I never was able to get it working on macOS.