I would like to install hardware environment in a docker container. One of the installation scripts uses modinfo utility to detect ftdi_sio module, but it can’t find this particular part. There is also other error:
No FTDI driver present
I’m using centos7 image from the docker hub in this container. Is there any way this OS has not all necessary drivers and if so how to install necessary components in this image?
Appreciate for any help
2
Answers
You cannot install Linux kernel drivers from a Docker container, and generally one of the major design goals of Docker is to hide details of the underlying hardware from you.
If you’re trying to use tools like
modinfo
to inspect the system you’re actually running on and see if some specific kernel driver or piece of hardware is available, you need to run these directly on the host, not in Docker. If you’re trying to develop a hardware driver or interface, simulating it in a virtual machine (with its own kernel) is probably better than trying to work with it in Docker.(In principle you can disable enough of Docker’s protections to do this, but it makes your container setup very tightly bound to your host setup and removes basically all of the isolation; you’re getting nothing but complexity from having Docker in the mix.)
Actually, you can make this work, because
modinfo
does not require module to be running.The reason
modinfo
can’t find it is that podman/docker is using the kernel of the host.modinfo
usesuname
system call to get name of the current running kernel, which then is used as part of the path to find the module. Since kernel is the host one, the path may only accidentally be correct.To make it work you gotta explicitly pass kernel name to
modinfo
call with-k
. Example of how it works from my podman container: