Docker loading kernel modules

In Linux host:

  • Run the container in privileged mode (–privileged)
  • Add all capabilities (–cap-add=ALL)
  • mount host /lib/modules into the container (-v /lib/modules:/lib/modules)
docker run --name container_name \
           --privileged \
           --cap-add=ALL -d \
           -v /dev:/dev \
           -v /lib/modules:/lib/modules \
           image_id

Caution: Here all Linux capabilities are added so capabilities can be refined. Few words about Linux capabilities Model

Leave a Comment