USB portforwarding to docker container for serial data

OS: Ubuntu 18.04 and Linux for Tegra (Jetson xavier embedded device)

I am trying to connect a couple of usb devices to my docker container. I found that when calling the docker run command the devices can be given as options.

However it would be preferable to have the usb ports forwarded to the docker container when building the container.

Is this at al a possibility?

Hmm … not sure if I understand your question …

If your USB is accessible by your host, its content is also available to the docker image at build time …
But when you run the container and you want access to your (e.g.) USB pen-drive, you’ll need a volume to get to it.

Something like:

docker run … -v /dev/bus/usb:/dev/bus/usb … -d myDockerContainer

Thanks for replying.

What i want to achieve is reading out camera data or a joystick from my docker. However I also want to keep the

docker run …

as simple as possible hence I was wondering if the usb ports can be forwarded when the container is build instead of when it is run, so included in the dockerfile that composes the container.

No, that will not work