Is there a way to specify in the yml file that a device should be mounted with --device
instead of a volume. For my particular use case if it’s mounted as a volume it doesn’t work.
My Use Case:
I have a few infrastructure components I have to run tests against. These are 3rd party appliances we integrate with, that can only be run as a complete OS, one example would be router software like pfsense.
I’ve got a Vagrant setup that can spin up the the VM and then run the test. I’ve tested and you can indeed run this from within docker:
docker run --rm --device /dev/vboxdrv --device /dev/vboxnetctl myimage vagrant up
For anyone who wants to try this, you have to use the exact same version of virtualbox inside the container and on the host.
So ubuntu:20.10 docker and 20.10 host works seamlessly
If vboxnetctl is mounted as a volume instead of a device
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["hostonlyif", "create"]
Stderr: 0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg*)" at line 95 of file VBoxManageHostonly.cpp