• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

245
Views
docker linux container doesn't support driver development?

To develop driver program, we need /lib/modules//build directory. But I found under docker image of centos, even after I

yum install kernel-devel

There's still no such a directory with all its contents. Question:

(1) how to make it possible to develop driver in a docker linux environment?

(2) is it possible to load this developed module?

about 3 years ago · Santiago Trujillo
3 answers
Answer question

0

Docker is not virtual machine.

Ubuntu with docker is not real ubuntu.

If you want to develop with ubuntu, you should use virtualbox or vmware.

Check this link for more information

about 3 years ago · Santiago Trujillo Report

0

Docker uses the kernel of the host machine.

about 3 years ago · Santiago Trujillo Report

0

After reading this page, I almost gave up building a kernel module in Docker so I'm adding this answer hoping it helps somebody. See also what-is-the-difference-between-kernel-drivers-and-kernel-modules

You can build Kernel modules in Docker as long as the Kernel source required for the build is available inside Docker. Lets say you want to build against the latest kernel source available in your yum repos, you could install the kernel source using yum install kernel-devel. The source will be in /usr/src/kernels/<version> directory. You could install specific version of kernel-devel from your repo if that is what you want.

Then build the module using $ make -C <path_to_kernel_src> M=$PWD where the path to the kernel source would be /usr/src/kernels/<version>.

Read - Kernel Build System » Building External Modules

Docker container uses the kernel of the host machine so if you want to build against the running kernel, i.e., the kernel of the Docker host machine, you could try running the container in privileged mode and mounting the modules directory. docker run --name container_name --privileged --cap-add=ALL -v /dev:/dev -v /lib/modules:/lib/modules image_id See this

You should not load the modules on a kernel that is not the same as the one the module was built for. You could force install it but that is highly discouraged. Remember your running kernel, i.e., the Docker host kernel, is the kernel of the Docker container irrespective of what kernel-devel version you installed.

To see the kernel the module was built for (or built using), run modinfo <module> and look for vermagic value.

Dynamic Kernel Module Support is also worth a read.

about 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error