Docker Community Forums

Share and learn in the Docker community.

VirtualBox vboxdrive inside docker - problems with linux headers


(Nptech) #1

Hi all,

I’m trying to set up a environment to build VirtualBox images (ovf/ova) on our CI toolchain. For this case I started with the official packer dockerfile and modified it to fit my purposes.

The packer installation itself works fine. But I need VirtualBox installed into docker to be able to build OFV and OVA images. At first I changed the base layer from alpine to Ubuntu to have a Linux where VirtualBox is available for. Using Ubuntu I ran into problems because the only headers that were available from the package sources are the linux-headers-generic and linux-headers-virtual. I could install the virtual headers via apt-get but VirtualBox refused to use them and was looking explicitly for the headers for uname -r.

So I tried Debian. There I was able to download and install the Linux headers for uname -r which are 4.9.0-4-amd64 in my case. Running modprobe vboxdrv results in:

modprobe: ERROR: ../libkmod/libkmod.c:514 lookup_builtin_file() could not open builtin file '/lib/modules/4.9.0-4-amd64/modules.builtin.bin

module.builtin.bin is in place but it seems that this file is 0 bytes.

Running depmod results in:

depmod: WARNING: could not open /lib/modules/4.9.0-4-amd64/modules.order: No such file or directory
depmod: WARNING: could not open /lib/modules/4.9.0-4-amd64/modules.builtin: No such file or directory

And these two file are actually not there.

I just heard that docker uses the kernel of the host system and it is not possible to install kernel modules. So what’s the proper way to get the vboxdrv running?