I've connected external HDD via USD on macOS, and I'm running Ubuntu's Docker container as:
docker run -it --device=/dev/disk3 --privileged ubuntu bash
but the device is not present in the container:
# ls /dev/disk3
ls: cannot access '/dev/disk3': No such file or directory
# fdisk -l
Disk /dev/sda: 59.6 GiB, 63999836160 bytes, 124999680 sectors
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 124999679 124997632 59.6G 83 Linux
Here is another attempt:
$ docker run -it --device=/dev/disk3:/dev/sdb --privileged ubuntu bash
# ls /dev/sdb*
ls: cannot access '/dev/sdb*': No such file or directory
# fdisk -l
Disk /dev/sda: 59.6 GiB, 63999836160 bytes, 124999680 sectors
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 124999679 124997632 59.6G 83 Linux
Here is the device which I'm trying to add to the container (as reported on macOS):
$ diskutil list /dev/disk3
/dev/disk3 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *1.0 TB disk3
1: Linux 1.0 TB disk3s1
$ sudo fdisk /dev/disk3
Disk: /dev/disk3 geometry: 121601/255/63 [1953525167 sectors]
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: 83 1023 254 63 - 1023 254 63 [ 2 - 1953525165] Linux files*
2: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
Similar issues are posted here:
- How do I access a USB drive on an OSX host from inside a Docker container?
- How to mount a device of host to host in a Docker container?
However, I cannot mount it on macOS host, as the partition is formatted to Linux file system (ext4) which is not supported. That's why I'm trying to pass through the device to the Linux Docker container, but the device isn't shown.
What am I missing?