Make kernel modules accessible by docker network plugin

I am implementing a custom network driver for docker based on netmap. I’m having issues on the docker network plugin accessing the netmap kernel module because the docker container where the driver is, cannot access the kernel modules. In a “normal” container, I just need to pass the /dev directory and the lib/modules directory as volume (as explained in this answer), but I really don’t know how to do that with a docker plugin.

How can I make my docker network plugin able to access kernel modules? Or in other words, how can pass volumes to the docker plugin?

I have never created network plugins, but do you really need to access the kernel module files in the driver container? You can add capabilities to the container the the container will be able to “talk” to the kernel. I think I needed to mount those files in a container only once, but I don’t remember why I needed that. I need to deal with the kernel occasionally, so I always forget about what is required and what not :slight_smile:

Have you checked the plugin reference?

It mentiones mounts and capabilities too.

Hi @rimelek,

Yes, that’s what I tried yet still with no luck. This is my current config.json file in case it might be useful:

{
	"description": "vale - veth network driver in Python",
	"documentation": "https://github.com/sergio-gimenez/netmap-docker-driver",
	"workdir": "/usr/src/app",
	"entrypoint": [
		"./run.py"
	],
	"env": [
		{
			"name": "ENVIRONMENT",
			"value": "production"
		},
		{
			"name": "HOME",
			"value": "/usr/src/app"
		}
	],
	"interface": {
		"types": [
			"docker.networkdriver/1.0"
		],
		"socket": "vale.sock"
	},
	"linux": {
		"capabilities": [
			"CAP_NET_ADMIN",
			"CAP_SYS_ADMIN",
			"CAP_SYS_MODULE"
		]
	},
	"mounts": [
		{
			"type": "bind",
			"source": "/dev/netmap",
			"destination": "/dev/netmap"
		}
	],
	"network": {
		"type": "host"
	}
}

Docker still complains that it cannot find the kernel module:

Sep 06 14:52:43 Inspiron1373594a8fa97f dockerd\[1454\]: time="2022-09-06T14:52:43+02:00" level=error msg="/dev/netmap: No such file or directory" plugin=dd31f950e55dc993f99ecb0d8d8971f5a5cc9419bbbfba9d963cdd6377533768

I would say I’m mounting the folder properly, as well as giving the needed capabilities. But still not sure what I’m missing…

Then maybe I misunderstood that option