I would like to use some functions like fuse (sshfs) in a docker container, which is provided by kernel. I can load the modules easily in docker containers with privileged mode. However, if I would like to load the module when the container start and do not let it load other modules, is it possible?
Are you sure the problem is actually loading modules? If I do this:
% docker run -it ssh-test bash root@090961bb6f3a:/project# sshfs xxxx@xxxx:/xxxx/xxxx /mnt
fuse: device not found, try 'modprobe fuse' first
The reason is that Docker containers have restricted capabilities. The way to work around it is to run the container with
% docker run -it --cap-add SYS_ADMIN --device /dev/fuse ssh-test bash
which lets me use sshfs to mount volumes.