Device name with ":"

First of all the devices section is a list of device mappings, not a list of devices. The way you defined it would mean that

/dev/disk/by-id/usb-ST2000DL_003-9VT166_152D00539000-0

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

ln -s "/dev/disk/by-id/usb-ST2000DL_003-9VT166_152D00539000-0:0" "$PWD/compose-usb-0"
ln -s "/dev/disk/by-id/usb-ST2000DL_003-9VT166_152D00539000-0:1" "$PWD/dev/compose-usb-1"
      devices:
        - "$PWD/compose-usb-0:/dev/compose-usb-0"
        - "$PWD/compose-usb-0:/dev/compose-usb-0"

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.