Docker Help Request: I am trying to connect a container within our Swarm to a device in /dev
. The connection works correctly via device mapping when running in a docker container, however we are unable to connect to the device within our Swarm node.
The device happens to be graphics hardware to use vaapi drivers with our Gstreamer pipeline, and is located here: /dev/dri/renderD128
, but this is a generic question for connecting to any device from a container in a swarm.
I am looking for advice on what it would look like to map to our device through Swarmkit Generic Resources.
There is discussion available regarding Swarmkit and graphics hardware including:
- (Issue) Add Support for Swarmkit Generic Resources #33439: https://github.com/moby/moby/issues/33439
- (Merged PR) Add Generic Resources #5416: https://github.com/docker/docker.github.io/pull/5416
But, I have been unable to distill these into a solution.
One docker run command that successfully connects to this device when NOT running in the swarm looks like this:
docker run -ti \
-e XDG_RUNTIME_DIR=/tmp \
--device=/dev/dri/card0:/dev/dri/card0 \
--device=/dev/dri/renderD128:/dev/dri/renderD128 \
-v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/tmp/$WAYLAND_DISPLAY \
<docker-image> bash
But again, this is a generic question for containers, swarms, and device mapping in general, and is not related to this particular device.
We are using docker compose file version 3, and have tried the "device
" option which fails as expected:
https://docs.docker.com/compose/compose-file/#devices
"This option is ignored when deploying a stack in swarm mode with a (version 3) Compose file."
I am grateful for your help.