is it possible to run virtualbox inside a docker container

前端 未结 3 1154
花落未央
花落未央 2020-12-24 01:57

I tried running the container in privileged mode, but still the vboxdrv cannot be loaded.

I get

WARNING: The vboxdrv kernel module is not loaded. Eit         


        
3条回答
  •  抹茶落季
    2020-12-24 02:41

    Yes, you can. You'll need to make sure you have the kernel module on your host system. I'm running Ubuntu, but I'm sure it'd be similar on other distros:

    sudo apt-get install linux-headers-generic virtualbox-dkms
    

    And make sure the kernel module is loaded:

    sudo /etc/init.d/virtualbox status
    VirtualBox kernel modules are loaded.
    

    Now, run the docker container, and mount /dev/vboxdrv as a volume:

    docker run -it -v /dev/vboxdrv:/dev/vboxdrv your/container-image
    

提交回复
热议问题