13

Back in the day, I was using VirtualBox (VB) and Vagrant (V) to run VMs. Since I installed docker-for-windows (DfW) and run V, VB complains about Hyper-V (HV).

[user@localhost ~]$ vagrant up
Stderr: VBoxManage.exe: error: VT-x is not available (VERR_VMX_NO_VMX)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component
ConsoleWrap, interface IConsole

Although this link indicates that V supports HV, the above error message is contradictive. Why does VB look incompatible with HV, why V says that it supports HV and how to prevent that HV needs to be disabled in order to use V again.

| Product    | Version |
|:-----------|--------:|
| Vagrant    |   2.0.1 |
| VirtualBox |   5.2.4 |
| Windows    |      10 | 

Discussion

The suggestion to switch Hyper-V on and off is not the preferred solution as it is time consuming.

If it would be possible to run V and DfW on the same system by replacing VB this could be an option.

0
9

Confirmed by this answer on SO referencing Microsoft technet once Hyper-V is activated it mask the VT-X instructions of the processor to the OS on top of it and windows run like a guest.

Docker for Windows need hyper-V to work, so disabling it is not really an option.

There's no way to have virtual box running on top of Hyper-V and that's quite normal, you should not run an hypervisor within an hypervisor, they'll fight to orchestrate hardware acces.

The best workaround in my opinion is to create hyper-V virtual machine from vagrant with the hyper-V provider instead of virtual box machines, this way you can create VM or container on the same session.

Side note, vagrant already have a note about this in the hyper-v provider documentation page (found while searching the link to add above):

Warning: Enabling Hyper-V will cause VirtualBox, VMware, and any other virtualization technology to no longer work. See this blog post for an easy way to create a boot entry to boot Windows without Hyper-V enabled, if there will be times you will need other hypervisors.

4

A few years later this thread is still the first result in Google, but running Docker+Vagrant (with VirtualBox) on Windows isn't a challenge anymore. You can easily run them both, as described here

If for some reason you want to use Vagrant with VirtualBox as a provider you should update to VB 6.x - after that, you can run VirtualBox, Vagrant, and Docker at the same time. Just configure your VM to use Hyper-V as Paravirtualization Interface. You can do it by VirtualBox GUI (VM's Settings -> System -> Acceleration -> Paravirtualization Interface) or by using Vagrantfile:

Vagrant.configure("2") do |config|
  # your config (…)
  config.vm.provider "virtualbox" do |vb|
    vb.customize [
      "modifyvm", :id,
       " - paravirtprovider", "hyperv"
    ]
  end
  # your config (…)
end

This will work not only for Windows Enterprise/Pro/Edu but also for Home Edition (with WSL2 as Docker Backend). This solution shouldn't break your VirtualBox's machine, so you don't have to switch hypervisorlaunchtype over and over again.

1
  • Aww, nice one, I totally missed it was still using virtualbox when reading the blog post.I see value for the home edition of Windows where the Hyperv api is not complete.
    – Tensibai
    Mar 16 at 20:35
0

Alongside Vagrant, you could use the old school Legacy 'Docker Toolbox' instead of 'Docker for Windows'. That means Docker will be slow since its running in a Linux VM I believe. https://docs.docker.com/toolbox/toolbox_install_windows/ Other than that, yes I have been restarting my computer everything i need HyperV for Docker or remove it when i want vagrant.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.