Docker Community Forums

Share and learn in the Docker community.

Exposing devices to docker container from OCI Prestart Hook

I was trying to expose a specific device under /dev/devicex in ubuntu (host) to docker container from my OCI pre start hook.

What I did: In the OCI pre start hook bind mounted the device to container /dev directory and the bind was successful.

What I see: ls /dev doesn’t list the device under /dev in container. cat /proc/mount shows that the device is mounted on the container. udev /dev/devicex devtmpfs rw,nosuid,relatime,size=24080328k,nr_inodes=6020082,mode=755 0 0

Could some explain the way to selectively mount the device into docker container from oci prestart hook. I know docker supports docker run --device=/dev/devicex and that works. But I would like to achieve the same from Pre start Hook.