Docker Community Forums

Share and learn in the Docker community.

Can't install virtualbox in docker

I use docker on Ubuntu 16.04 service and want to install virtualbox and vagrant in the container.
I’m sure the installation was successful but vagrant was unable to create a vboxnet when creating a virtual machine, Can docker provide interface for virtualbox ?

What did I do wrong?

Docker version 1.11.2, virtualbox 6.1 vagrant 2.2.6

There was an error while executing VBoxManage, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: [“hostonlyif”, “ipconfig”, “vboxnet1”, “–ip”, “172.16.0.1”, “–netmask”, “255.255.255.0”]

Stderr: VBoxManage: error: The host network interface named ‘vboxnet1’ could not be found
VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component HostWrap, interface IHost, callee nsISupports
VBoxManage: error: Context: “FindHostNetworkInterfaceByName(Bstr(pszName).raw(), hif.asOutParam())” at line 232 of file VBoxManageHostonly.cpp

To put it simply, you cannot create and start a VM from within a container.
One of the reasons (it’s not the only one) is the one you see here : the container cannot change its IP stack (starting the vboxnet1 bridge).