How to pass a /dev/disk device on macOS into Linux Docker?
Docker was built for linux, it runs on Mac through HyperkIT, which is a lightweight hypervisor. This means Docker only sees devices connected to the hyperkit hypervisor, rather than the devices connected to the Mac.

Unfortunately, Hyperkit has issues with USB device passthrough from your MacOS to the hypervisor (read more here) so the --device command won't be much use to you here. You have three options,

Option 1: Mount the ext4 drive to your Mac (not recommended)

Whilst your Mac doesn't natively support ext4, there are ways around this. I have installed ext4fuse on your Mac by following this tutorial. When you have mounted your device, add it to your ubuntu container with the -v flag,

docker run -v &lt;Your_volume&gt;:&lt;dest_volume&gt; -it ubuntu bash


Making sure that the directory of your volume has been added to the file sharing folders in Docker.

Option 2: create a docker-machine using the virtualbox driver and add the device to the virtualbox vm (still not recommended)

Follow this great tutorial here which goes through installing a docker machine with a virtualbox driver and mounting the USB stick.

Option 3: Run Docker on linux (recommended!)

I wouldn't recommend using Docker for Mac. It was built for linux and if you don't switch to linux you'll waste your time troubleshooting issues like these for no real reason.

I've got a mac, but run a few ubuntu cores in virtualbox and then install docker on top of them, that way I can play around with docker starm too (which you can't with docker Mac unless you use docker-machine!