My issue is the following: I want to give to my container full access to a specific device (an FPGA card). So my plan is to use the --device option. This device option’s syntax is the following:
docker run --device=Host Device:Container Device Mapping:Permissions
My problem is the name of my device contains “:” characters like in /dev/mydevice/FAB,yp-troll.0004:00:00.1.0. And so when using this name, docker is lost:
docker: bad mode specified: 00.1.0.
Needless to say I cannot change the name of my device (or use a symbolic link with a simplest name), because this exact name is used by several tools.
How could I use such device name without docker interpreting the “:” in the name ?
(I did try ', ", \, etc)
FYI, I did have the same issue when trying to mount into my container any directory (like /sys/devices/pci0004:00) containing colons in its name. I see in forums that I’m not the only one facing issue with docker when you want to work with file names containing colons. And I did not find any form of escaping for those colons…
No idea really ?? Am I facing a dead end ?
is the source device on the host and you want to attach it to the container two times. Once as “0” and once as “1”.
This is the same as you mount files or fodlers from the host.
Second, a mapping contains colons as separators, so you can’t have it in the values. As you probably now many files under /dev/disk are actually symbolic links and /dev/ itself can contain symbolic links to disks. You can controll it with udev. So you could create an other symlink under /dev.
In this case you can simply make two sombolic links in the compose project folder pointing to the two devices and use that symlink in the compose file. These symlinks would exist after reboot
Note that $PWD is required since it looks like the devices section doesn’t support relative path, but $PWD depends on where you run the compose command so you can replace that variable with your actual project path if you want.
Some folders have colons in them. Some devices have colons in them.
What’s the best way to escape colons in Docker Compose, so that it may better support such devices and folders?
Here’s my situation:
$ ls -la /dev/disk/by-id
total 0
Jan 17 10:51 .
Jan 17 10:51 ..
Jan 17 10:51 ata-CT250MX500SSD4_2028E2B61977 -> ../../sda
Jan 17 10:51 ata-WDC_WD20EFAX-68B2RN1_WD-WXB2A7179H3F -> ../../sdd
Jan 17 10:51 ata-WDC_WD20EFAX-68B2RN1_WD-WXB2A7179THF -> ../../sde
Jan 17 10:51 ata-WDC_WD20EFAX-68B2RN1_WD-WXB2A71DTKN1 -> ../../sdf
Jan 17 10:51 ata-WDC_WD20EFAX-68B2RN1_WD-WXB2A71K4UC0 -> ../../sdg
Jan 17 10:51 ata-WDC_WD20EFRX-68EUZN0_WD-WCC4MCYYH9D9 -> ../../sdh
Jan 17 10:51 ata-WDC_WD20EFRX-68EUZN0_WD-WCC4MEF9H43X -> ../../sdi
Jan 17 10:51 ata-WDC_WD20EFRX-68EUZN0_WD-WCC4MKE5AN2H -> ../../sdj
Jan 17 10:51 ata-WDC_WD20EFRX-68EUZN0_WD-WCC4MLAAX66L -> ../../sdk
Jan 17 10:51 usb-ST2000DL_003-9VT166_152D00539000-0:0 -> ../../sdb
Jan 17 10:51 usb-ST2000DL_003-9VT166_152D00539000-0:1 -> ../../sdc
You can see that sdb and sdc have colons in their device id. They are two separate Seagate 3.5" HDDs - they just stupidly define themselves by manufacturer and mode number rather than manufacturer and model number and serial number, like the Western Digital examples.
I am unable to pass the device id with a colon in it.
I’ve looked at the values available using sudo udevadm info -a -n /dev/sdb and sudo udevadm info -a -n /dev/sdc, and I cannot find a way to reference them directly.
I could create a symbolic link, but that might not persist with disconnects. The /dev/disk/by-id value will persist between reboots and disconnects.
We’re able to escape other characters, and Docker on Windows manages the use of colons fine - can this be addressed on other platforms, perhaps with single quotes, double quotes, double understores, backslashes, or any other process?