I've recently run into this problem after having used docker toolbox without a problem for a while.
Started happening after windows update?
Windows 10 Home - 64
Uninstalled and reinstalled Docker toolbox
Uninstalled and reinstalled various versions of VirtualBox
Still get the same error
Running pre-create checks...
Creating machine...
(default) Copying C:\Users\me\.docker\machine\cache\boot2docker.iso to C:\Users\me\.docker\machine\machines\default\boot2docker.iso...
(default) Creating VirtualBox VM...
(default) Creating SSH key...
(default) Starting the VM...
(default) Check network to re-create if needed...
(default) Windows might ask for the permission to create a network adapter. Sometimes, such confirmation window is minimized in the taskbar.
(default) Creating a new host-only adapter produced an error: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe hostonlyif create failed:
(default) 0%...
(default) Progress state: E_FAIL
(default) VBoxManage.exe: error: Failed to create the host-only adapter
(default) VBoxManage.exe: error: Querying NetCfgInstanceId failed (0x00000002)
(default) VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
(default) VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleCreate(struct HandlerArg *)" at line 71 of file VBoxManageHostonly.cpp
(default)
(default) This is a known VirtualBox bug. Let's try to recover anyway...
Error creating machine: Error in driver during machine creation: Error setting up host only network on machine start: The host-only adapter we just created is not visible. This is a well known VirtualBox bug. You might want to uninstall it and reinstall at least version 5.0.12 that is is supposed to fix this issue
Looks like something went wrong in step ´Checking if machine default exists´... Press any key to continue...
Re: Host only networking problems Go to VirtualBox network adapter properties under Windows' control panel, select "TCP/IPv4" and go to its properties. Check the options to obtain the addresses automatically. Go to VirtualBox > File > Preferences > Network and reconfigure the adapter again.
Host-only Networking Description Instead in VirtualBox you can create one or more (up to 8) virtual adapters for connections between the host and virtual machines created in VirtualBox on the host. A VirtualBox host-only adapter can also function as a DHCP server to assign ip addresses to VirtualBox virtual machines.
Promiscuous mode means the adapter can have multiple MAC addresses. Most wireless adapters do not support this. In that case VirtualBox replaces the MAC address of packages which are visible to the adapter. An external DHCP server is used.
This answer is not specifically related to Docker, but seeing as this is one of the more recent top Stack Overflow search results (together with this question) on Google when searching for the "Failed to create the host-only adapter" error message from VirtualBox, I'm leaving this here in the hope that it will help someone else.
As a side note, if you can, I recommend you use Docker For Windows instead of Docker Toolbox to run Docker on Windows (requires Windows 10 Professional or Enterprise 64-bit).
My scenario:
When trying to create a host-only adapter using the Host Network Manager GUI, I got the dreaded "Failed to create the host-only adapter" error message, with a detail of: "Querying NetCfgInstanceId failed (0x00000002)".
Because I use Hyper-V, I had a number of Hyper-V Virtual Ethernet Adapters in addition to the actual physical adapter.
Looking at the properties of the physical adapter, it appears to be normal for Hyper-V to turn off all of the protocol drivers except for "Hyper-V Extensible Virtual Switch". Windows then gets its network connectivity through one of the virtual adapters, in my case it's called "External Virtual Switch", and the usual set of protocol drivers (TCP/IPv4 etc.) is enabled there.
I then noticed that VirtualBox appears to (want to) work in a similar fashion, because it had managed to install and enable a new protocol driver called "VirtualBox NDIS6 Bridged Networking Driver".
When I checked the properties of the other, virtual, adapters I noticed that the "VirtualBox NDIS6 Bridged Networking Driver" was enabled on all of them, but the "Hyper-V Extensible Virtual Switch" was not. It seemed odd that the VirtualBox driver was enabled on the Hyper-V virtual adapters, so I disabled it on all of them but left it enabled on the physical adapter.
I think at this stage I threw in a good old reboot for good luck, though I doubt whether that was actually necessary. When I subsequently tried to create the VirtualBox host-only adapter again, it worked! (I actually got an error message from VirtualBox, in a modal that I had to find on the taskbar, about the adapter name already being used. However a new "VirtualBox Host-Only Ethernet Adapter" showed up under the Windows Network Connections and when I closed and re-opened the VirtualBox Host Network Manager window, the adapter showed up there too.)
TL;DR;
My theory is that VirtualBox is for some reason unable to determine which adapter is the actual physical network adapter, and in a rather gung-ho manner goes ahead and enables its "VirtualBox NDIS6 Bridged Networking Driver" on every adapter that it finds.
Furthermore it then appears to be unable to determine which adapter it needs to create its virtual "wrapper adapter" for and fails.
Even if you don't use/have Hyper-V, you might have multiple adapters including virtual ones (lots of VPN software installs virtual adapters too, for example).
You can try disabling the "VirtualBox NDIS6 Bridged Networking Driver" on all but your actual physical network adapter(s) before attempting to create the VirtualBox host-only adapter again.
This is certainly not a new issue for VirtualBox judging by the large number of related tickets on their public bugtracker and in other places, some more than 2 years old. I have a feeling that for a lot of people the problem might be related to what I have described above, so hopefully this helps them.
Edit 01/15
Hmm, in retrospect I'm not sure how normal it is for Windows to use the Hyper-V "External Virtual Switch" for network connectivity. If I remember correctly the "Default" switch that Hyper-V creates and which provides connectivity to guests via NAT is a relatively new thing and before it was necessary to add and use the "External" switch... On my home PC, without an "External" switch, the normal (TCP/IPv4 etc.) protocol drivers stay enabled on the physical network adapter and the "Hyper-V Extensible Virtual Switch" is disabled both on the physical and on the virtual adapters. I haven't had a chance to test what happens if I add a new "External Virtual Switch" under those circumstances.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With