That question doesn’t really make sense. Since Docker containers share the host kernel, and Linux kernel modules have to match the running kernel exactly, there’s almost no way you could have a valid set of modules you could dynamically load, even if you were allowed to load modules, which by default you aren’t.
(If you ran a privileged container that happened to embed modules for, say, kernel 4.4.0-22-generic, the container would only run on Ubuntu 16.04, and wouldn’t run if there was a kernel update or I changed the stock kernel or my host was Ubuntu 14.04 or my host was CentOS 7.)
I got the packages installed with apt-get install kmod. lsmod and lsprobe are now available.
Regarding the first part of your question, I think I got a hint of what you mean. I think I would re-frame and re-ask my question in a separate thread. Essentially what I am trying to do is this: - The host machine has a PCI device driver installed. I want to be able to access this same device from my container.
If module is loaded into the kernel from the host already it will be available inside the container. Containers use the exact same kernel from the host and are just userspace processes with special properties. You may have to grant the container access to the device using flag such as --device to docker run.
How then should I use the --device flag in docker run command? Should it be --device "10:11.2" or --device "identifier" or something of that sort to make this device available to the container?