Docker Community Forums

Share and learn in the Docker community.

Docker not passing UDEV events to container even after using --net=host

I am running docker on Alpine bare metal and when running udevadm monitor on the host system I can see both KERNEL uevents and UDEV events, however when I run the same command inside a container I only see the KERNEL events.

The command I am using to run the container is docker run -it --rm --net=host alpine:3.11.

Is there something else I am missing? Or am I not supposed to receive the UDEV events but actually run an install of udevd (or systemd-udevd) inside my container?

My only other thought is the dockerd for Alpine isnt compiled against lubudev like the one distributed by docker for ubuntu and this may be required to pass the UDEV events on the to container.

Udev is a daemon, not a service (aka it’s not listening any network port)
Using --net=host wont allow your container to talk to a daemon on the host.
I havent checked the details but as far as I know, the events that udev trigger goes to HAL through dbus. You probably want to share your host dbus socket directory (/run/dbus on my debian sid) with your container.

EDIT: nope. That’s not how udevadm works. It doesnt use dbus (unlike HAL).
Running the command strace udevadm monitor show that udevadm connect to udev using udev own socket which on my debian is at : /run/udev/control. That’s what you have to share with your container (a volume will do)


Thanks for your response, that was the missing piece of the puzzle.

It didnt help that my initial testing was using Alpine linux with eudev which seems to have an issue whereby it wont display UDEV events inside a container when an ubuntu instance deployed with the exact same command line does.