Installing docker on azure virtual machine windows 10 - azure

I am getting an error upon installing docker on azure virtual machine.
m/c configuration: azure vm, windows 10 enterprise, Intel 2.4 GHz, 7 GB RAM, 64-bit operating system, x64-based processor.
I went through a few blogs and they asked me to enable nested virtualization on azure vm as follows.
Set-VMProcessor -VMName MobyLinuxVM -ExposeVirtualizationExtensions $true
But this also didn't help and the virtual m/c MobyLinuxVM failed to start.
I have installed Hyper-V and Container components from windows features. But the error shows "because one of the Hyper-V components is not running" whereas all the components of Hyper-V are running.
I checked the task manager performance tab and I don't see the virtualization option there. I can't modify the virtualization settings in the BIOS as I am installing docker on an Azure VM. Also I tried disabling the windows firewall but that didn't help.
So how to run docker on azure virtual m/c windows 10 enterprise.

Here is a solution if you are getting this error on Azure Windows 10 VM where you have installed Docker:
Ensure Windows Hyper-V featutes are enabled by running PowerShell cmdlet:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -Verbose
Ensure Windows Containers feature is enabled by running PowerShell cmdlet:
Enable-WindowsOptionalFeature -Online -FeatureName Containers -All -Verbose
Ensure Hypervisor is set to auto start in the Boot Configuration Database (BCD) by running in elevated command prompt the command:
bcdedit /set hypervisorlaunchtype Auto
After running all of the above and you restart the Azure VM, Docker should be starting normally.

Azure doesnt yet allow for nested virtualization.
You need to use DSv3 or E3 instances for that. Just use docker like you normally would

Microsoft offers images with preinstalled docker enterprise. This works even on a B2s VM. Just select any of the "Microsoft Server 2019/2016 Datacenter with containers" image while creating the VM.

Related

Got access denied when tried to enable Hyper-V through Powershell command with Serial Console on a Windows Server 2019 VM (Azure)

I created a VM with Windows Server 2019 Datacenter image in Azure. Due to company policy, we are not allow to have a public IP and port. The only way to access the VM is using the Serial Console.
I was able to run PowerShell in serial console. However, I got the access problem.
Error:
PS C:\windows\system32> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V
Enable-WindowsOptionalFeature : Win32 internal error "Access is denied" 0x5
occurred while reading the console output buffer. Contact Microsoft Customer
Support Services.
At line:1 char:1
+ Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ReadError: (:) [Enable-WindowsOptionalFeature],
HostException
+ FullyQualifiedErrorId : ReadConsoleOutput,Microsoft.Dism.Commands.Enable
WindowsOptionalFeatureCommand
I tried to elevate the Powershell prompt, but no luck. The account I created should have admin access. I wonder there is any way I can get this working. Thanks in advance.
I believe there is some limitation on the Server 2019 Datacenter image because I also get the same error but it worked on the Server 2016 datacenter refer to this.
As a workaround, If the Azure VM does not have a public IP address assigned, I suggesting run PowerShell scripts within the Azure VM via run command. The feature uses the virtual machine (VM) agent to run PowerShell scripts within an Azure Windows VM. For more information about running scripts in your Windows VM, you could refer to this document.
For example, you can enable hyper-v via PowerShell Scripts
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart
Then Invoke the scripts via Invoke-AzVMRunCommandcmdlet to run a PowerShell script on an Azure VM. The cmdlet expects the script referenced in the -ScriptPath parameter to be local to where the cmdlet is being run.
I also encountered this error message today, and I noticed I have an active RDP session to the target machine and with Windows PowerShell opened (for test purposes).
So I just tried to exit the PowerShell and close the RDP session, then it works!

Using powershell can we do automation script to auto restart the azure vm agent if the agent is not responding?

1) Verify Azure VM agent Status
2) IF status good, not require to restart agent. IF staus dellocated, require to restart agent.
You should start by first detecting if the VM agent is installed or not:
Get-AzVM
Result:
OSProfile :
ComputerName : myVM
AdminUsername : myUserName
WindowsConfiguration :
ProvisionVMAgent : True
EnableAutomaticUpdates : True
The Azure VM agent might be stopped, outdated, in an inconsistent state, or not installed and prevent Azure Backup service to trigger snapshots.
If the VM agent is stopped or is in an inconsistent state, Restart
the Agent and retry the backup operation (try an ad-hoc backup). For
steps to restart the agent, see Windows VMs or Linux VMs.
If the VM agent is not installed or is outdated, install/update the
VM agent and retry the backup operation. For steps to install/update
the agent, see Windows VMs or Linux VMs.
In order to run a process on Linux, follow below:
https://learn.microsoft.com/en-us/azure/virtual-machines/linux/run-command
Windows:
https://learn.microsoft.com/en-us/azure/virtual-machines/windows/run-command
Reference:
https://learn.microsoft.com/en-us/azure/virtual-machines/extensions/agent-windows#detect-the-vm-agent
https://learn.microsoft.com/en-us/azure/backup/backup-azure-troubleshoot-vm-backup-fails-snapshot-timeout#UserErrorGuestAgentStatusUnavailable-vm-agent-unable-to-communicate-with-azure-backup

Minikube installation on Azure VM - NV6(promo)

I am working onto install Minikube on Azure VM - Ubuntu - NV6.
I installed KVM2 driver, now as mentioned in the document it is required t have VT-x/AMD-v virtualization enabled in BIOS .
Question - How do i know if Azure VM - NV6 supports VT-x/AMD-v virtualization ? If it not by default, how can i enable it?
I also installed Minikube using curl, but it throws error if i try to start Minikube.
Any help would be much appreciated.
There are an on going issue on GitHub, will track it there.
https://github.com/kubernetes/minikube/issues/4730#issue-466395657
https://github.com/kubernetes/minikube/issues/4804#issue-469709296
Thanks

Hyper-V isolation not activated in Windows Server version 1803

I am trying to run Windows Server 2016 containers on a Windows Server version 1803 Service Fabric cluster in Hyper-V isolation mode, but it fails with:
No hypervisor is present on this system.
It seems that the docker daemon is not configured and needs to be activated for hyper-v isolation. How can I active Hyper-V on the Windows Server (Datacenter-Core-1803-with-Containers-smalldisk)?
DETAILS
HOST OS on ServiceFabric node
Publisher: MicrosoftWindowsServer
Offer: WindowsServerSemiAnnual
SKU: Datacenter-Core-1803-with-Containers-smalldisk
Version: 1803.0.20181017
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion
BuildLabEx REG_SZ 17134.1.amd64fre.rs4_release.180410-1804
CONTAINER OS
Windows Server 2016, builds 14393 (Long-Term Servicing Channel)
Docker Command
docker run --isolation=hyperv -it mcr.microsoft.com/windows/servercore:ltsc2016 cmd
Error response from daemon: container Error response from daemon:
container
0499ef6e3f17843644323fa62b822fd30b89cc8f4ac2ab7d05396fec51252ac7
encountered an error during CreateContainer: failure in a Windows
system call: No hypervisor is present on this system.
EDIT
Hyper-V is installed, I checked that with the following command:
Get-WindowsFeature -ComputerName xxx
You can only do nested virtualization on the Dv3 and Ev3 VM sizes. The Dv3 and Ev3 sizes are also some of the first VM’s to be running on Windows Server 2016 hosts. Windows 2016 hosts enable Nested Virtualization and Hyper-V Containers for these new VM sizes. Nested virtualization allows you to run a Hyper-V server on an Azure virtual machine. With nested virtualization you can run a Hyper-V Container in a virtualized container host, set-up a Hyper-V lab in a virtualized environment, or to test multi-machine scenarios. You can find more information on Nested Virtualization on Azure.

Could not connect to VM created with Azure command line tools

I am trying to use the Azure Command Line Tools (http://www.windowsazure.com/en-us/manage/linux/how-to-guides/command-line-tools/) to create an Ubuntu 12.04 VM.
I am issuing the following commands:
azure vm create xxxxxxxxxx.cloudapp.net b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-12_04_1-LTS-amd64-server-20121218-en-us-30GB azureuser mypassword --location "West Europe"
azure vm endpoint create xxxxxxxxxx 22 22
azure vm start xxxxxxxxxx
This seems to create and start the VM successfully.
I try to connect via SSH to the VM using the following command (on Mac OS X)
ssh azureuser#xxxxxxxxxx.cloudapp.net
However, when I try to SSH into the VM, it seems that password authentication is disabled on the VM as I am getting the following error:
Permission denied (publickey).
I would like to add that connecting via SSH to an Ubuntu VM created trough the Azure Management portal works absolutely fine. This issue only appears when the VM was created through the Azure command line tools.
Has anybody encountered a similar issue and knows how to solve it?
You need to use the --ssh switch on your azure vm create command to enable ssh. Adding the endpoint has no effect.
According to the Windows Azure command-line tool for Mac and Linux documentation you can only add ssh connectivity via the azure cli when the virtual machine is created.

Resources