Docker Community Forums

Share and learn in the Docker community.

Attach a raw disk to container


(Kevinzhu) #1

I want to attach a raw, unformated volume which has no file systerm configured to the container, is that possible and how?


(Nathan Le Claire) #2

Probably you want --device flag for docker run


(Lambertia) #3

Hi @nathanleclaire,

I haven’t had any luck getting devices mapped into docker for mac. Have you had any luck?

$ docker run --rm -ti --privileged --device=/dev/disk0:/dev/greg ubuntu ls -l /dev/greg ls: cannot access '/dev/greg': No such file or directory $ docker run --privileged --rm -ti --device=/dev/tty.SLAB_USBtoUART:/dev/ttyUSB0 ubuntu ls -l /dev/ttyUSB0 ls: cannot access '/dev/ttyUSB0': No such file or directory


(Nathan Le Claire) #4

I wouldn’t count on being able to use devices from your Mac on Docker for Mac. That would require some kind of device pass-through to the VM. You could share devices from within the VM to the container though.