I have a usb device that provides a CANbus interface to my host. I know this particular interface is kind of rare, but the important part is that when I run ifconfig, I can see the interface on my host, but I’m having the hardest time to make this available to my docker containers.
My first strategy was to mount devices or volumes from the /dev folder, but this particular device does not show up as any device within the /dev folder- I can only find it under /sys/class/net/can0, /sys/devices/pci…, or /dev/bus/usb/002/002. Even when running in privileged mode, this did not seem to be the most promising strategy.
I then turned to running my docker-compose network as bridged. This does make the ifconfig show the can0 device, but running in bridged mode makes it impossible to build connection strings using container hostnames, so this too does not necessarily seem like the best way to go.
I’ve since turned to trying to create a bridged network with the can0 interface and the docker network, but I’m not really sure how to do this. Could I maybe make an overlay network between the two? Has anyone had any experience with bridging a docker network with an interface on the host? Anything perhaps I’m missing with the first two ways that I went about trying to get this to work?