Forum Discussion
Nested virtualization in Azure
I would sugguest you to change the VM size to D4s_v5 to support nested virtualization scenarios.
fmartel Please help with this point also as how to run the command.
The documentation says to run it when the VM is in stopped state. While I run to execute the command under 'Run Command' section, it is mentioned that VM must be ON.
- fmartelJul 06, 2023Brass Contributor
I have never installed docker desktop, so I don't know what is the enduser experience.
So I think it is because you misunderstood the guide or I misunderstand the need.
I assume it is a some kind of manager that leverage Hyper-V container virtualization and the manager need to have virtualization extensions enabled during the install of during the container creation.
The thing is.. Set-VMProcessor is intended to be ran on a hyper-v host that as a stoped VM.
When ExposeVirtualizationExtensions is set to true to a VM, it allow this vm to run virtualization technologies on this VM. (Hyper-V)
So in your scenario the VM (Standard D4as v4) is managed by Microsoft in Azure and this VM have ExposeVirtualizationExtensions value set to false because nested virtualization is not supported on AMD servers in Azure. You must dealocate your VM, change the VM size to a VM size that support nested virtualization. After that you can install hyper-v in that VM and you should be able to spin a nested VM/container in that VM. Set ExposeVirtualizationExtensions to the new VM/container created would allow this child VM to run another hyper-V host inside.. which is a pretty much uncommon scenario.
Hope it make sense.
- abhi2689Jul 07, 2023Copper Contributorfmartel: Sorry I failed to communicate clearly.
I resized my VM as per your suggestion.
As per the document, I am supposed to execute the Set-VMProcessor command.
My question is where to execute the command.
The reason for the confusion is because of the following:
1. the document suggests that it has to be executed when the VM is in the stopped state.
In the Azure portal, for a VM, I see the option to execute this command 'Run Command' window. This window mentions that the command can be executed only when VM is running.
2. If I run this command from the 'Run Command' window or inside the VM, I get the error that it couldn't find the VM.
So this is nothing to do with docker till now. It is just Azure VM and nested virtualization. - abhi2689Jul 07, 2023Copper Contributorfmartel: Sorry for disturbing you again and again.
I have achieved the nested virtualization following https://learn.microsoft.com/en-us/azure/lab-services/how-to-enable-nested-virtualization-template-vm-using-script?tabs=powershell#enable-nested-virtualization-by-using-windows-tools on the VM size you had suggested.
Thank you for being there.