HowTo: Run Hyper-V/Docker on Hyper-V Virtual Machine
TL:DR; On the Hyper-V host run Set-VMProcessor -VMName "<Your Virtual Machine Name>" -ExposeVirtualizationExtensions $true
If you are like me, you may run all your Dev Environments from within Virtual Machines, leaving your base OS install as clean as possible – albeit with MS Office, Browsers etc. installed.
In recent projects I’ve been working with containerisation of system deployments with Docker. This has required me to have docker installed on my Virtual Machines. In order to run docker on Windows 10, i’ve needed to have Hyper-V installed… Hyper-V running on a VM !? Yup, it’s possible!
- A Hyper-V host running Windows Server 2016 or Windows 10 Anniversary Update;
- A Hyper-V VM running Windows Server 2016 or Windows 10 Anniversary Update;
- A Hyper-V VM with configuration version 8.0 or greater;
- An Intel processor with VT-x and EPT technology.
Configure Nested Virtualisation
- Create a virtual machine.
- While the virtual machine is in the OFF state, run the following command on the physical Hyper-V host. This enables nested virtualisation for the virtual machine.
Set-VMProcessor -VMName "<Your Virtual Machine Name>" -ExposeVirtualizationExtensions $true
- Start the virtual machine.
- Install Hyper-V within the virtual machine, just like you would for a physical server.