Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cohabitation Docker & VirtualBox on Windows

Docker uses the Hyper V functionality so it has to be enabled for Docker to work properly. However, the Hyper V functionality has to be disabled for VirtualBox to work properly (it's possible to create guests and emulate them but only if they're 32bits machines it seems).

Is there any way to have an healthy cohabitation with the two and for them to work at the same time? Instead of enable/disabling the Hyper V option and reboot every time?

like image 563
gaucib Avatar asked Oct 26 '16 03:10

gaucib


3 Answers

I understand your pain-point, but AFAIK this is just not possible to attain because of the simple fact that the virtualization technologies you mentioned here are of different types.

Hyper-V is a "Type 1" hyper-visor which runs on host machine hardware. Other examples in this category include Citrix XenServer and VmWare ESXi. Virtual Box is a "Type 2" hosted hyper-visor which runs within an OS. Other examples in this category include VmWare Player.

If you need to toggle b/w these, a restart is eminent.

A quick way to see the mode is by running "bcdedit" from Command Prompt to see the current config.

  1. To disable Hyper-V run:

bcdedit /set hypervisorlaunchtype off

  1. To turn Hyper-V back on run:

bcdedit /set hypervisorlaunchtype auto

However, you would need to reboot in both the cases. I just mentioned a easy config way to make you understand what was happening in the boot loader when toggling between the Type 1 and Type 2 hyper-visor modes.

like image 197
Runcy Oommen Avatar answered Oct 23 '22 08:10

Runcy Oommen


You can't have Hyper-V and VirtualBox together. But you can use the older docker toolbox if you wish. Unlike Docker for Window, Docker Toolbox uses VirtualBox and then you won't need Hyper-V.

like image 22
Remus Rusanu Avatar answered Oct 23 '22 06:10

Remus Rusanu


No there isn't.

Just do as I did and create those VMs in Hyper-V. Hyper-V is super fast and the only problem is graphics. Well nat also, and shared folders.

I installed a Xserver for Windows (xming) and sent the display from the VM to the desktop and works perfectly.

  1. Download and install xserver in windows from here: https://sourceforge.net/projects/vcxsrv/
  2. Install your distribution in a new Hyper-V virtual machine. Look in internet for instructions.
  3. Run your virtual machine and open a command prompt outside the GUI: Ctrl+Alt+F2. Type the following commands:

sudo apt install xfce4 echo xfce4-session >~/.xsession env DISPLAY=yourwindowsip:0.0 LIBGL_ALWAYS_INDIRECT=1 startxfce4

It should start a xfce desktop in windows. You can reduce the panels, and also hide the desktop window. It works very well and well integrated with windows desktop

UPDATE Check that your virtual machine and your host won't get the same IP. If it happens put an static IP in your virtual machine.

like image 4
Carlos Rafael Ramirez Avatar answered Oct 23 '22 07:10

Carlos Rafael Ramirez