Written by 5:11 am Azure, CICD, Cloud, DevOps ( Docker Kubernetes) • 2,346 Comments

Docker on Windows with Linux containers – Exception

March 30, 2021 0 Abhijit Kakade Azure CICD Cloud DevOps ( Docker Kubernetes)

Hello friends , Today I am writing this blog about one issue which I was facing from long time. I faced this issue multiple time in past as well but I cloud not found solution, but then I changed my scoped. Today after lot of R&D I got solution of it. I am sharing this solution with you all so if you face this issue then you should not waste your time on same.

I started my first Docker assignment on Linux VM and it worked very well. Till now I have completed more tasks with Docker on Linux. But when I tried to use Docker on Windows with Linux container it was failing.

About Issue

Docker on Windows with Linux containers was failing. I installed Docker on Azure Windows Virtual Machine it was working with Windows Container but as soon as switch is to Linux Containers it was failing with below error.

Docker.Core.HttpBadResponseException:

Unhandled exception: job failed with message: ‘DockerDesktopVM’ failed to start. (Virtual machine ID 904B37B8-3F94-4747-84D3-2523D05E92CA)

The Virtual Machine Management Service failed to start the virtual machine ‘DockerDesktopVM’ because one of the Hyper-V components is not running (Virtual machine ID 904B37B8-3F94-4747-84D3-2523D05E92CA).

More Details about this issue

I installed Docker on one Azure Windows 10 Virtual Machine it got installed correctly. Below you will find correct version of windows Virtual Machine which I had installed. It was Windows 10 version 1809.

After successful installation by default it was started with Windows containers. (You can find this details on task bar -> Right click on Docker Icon). You will see option to Switch to Linux Containers.

It was failing with below detail error as soon as I switch it to Linux container.

Complete Exception

Docker.Core.HttpBadResponseException:

Unhandled exception: job failed with message: ‘DockerDesktopVM’ failed to start. (Virtual machine ID 904B37B8-3F94-4747-84D3-2523D05E92CA)

The Virtual Machine Management Service failed to start the virtual machine ‘DockerDesktopVM’ because one of the Hyper-V components is not running (Virtual machine ID 904B37B8-3F94-4747-84D3-2523D05E92CA).   at Docker.Core.Logging.ClientExceptionInterceptor<InterceptResponseAsync>d__0.MoveNext() in C:\workspaces\stable-2.3.x\src\github.com\docker\pinata\win\src\Docker.Core\Logging\ClientExceptionInterceptor.cs:line 17— End of stack trace from previous location where exception was thrown —   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()   at Docker.Core.Logging.LoggingMessageHandler.<SendAsync>d__4.MoveNext() in C:\workspaces\stable-2.3.x\src\github.com\docker\pinata\win\src\Docker.Core\Logging\LoggingMessageHandler.cs:line 37— End of stack trace from previous location where exception was thrown —   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Net.Http.HttpClient.<FinishSendAsyncBuffered>d__58.MoveNext()— End of stack trace from previous location where exception was thrown —   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()  atSystem.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Docker.Core.HttpClientExtensions.<PostJsonWithJsonResponseAsync>d__1`1.MoveNext() in C:\workspaces\stable-2.3.x\src\github.com\docker\pinata\win\src\Docker.Core\HttpClientExtensions.cs:line 22– End of stack trace from previous location where exception was thrown —   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at ystem.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at Docker.Core.BackendAPI.BackendAPIClient.<StartHyperVVMAsync>d__11.MoveNext() in C:\workspaces\stable-2.3.x\src\github.com\docker\pinata\win\src\Docker.Core\BackendAPI\BackendAPIClient.cs:line 102

— End of stack trace from previous location where exception was thrown —  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()   at ystem.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)at Docker.Engines.LinuxHyperVEngine.<DoStartAsync>d__12.MoveNext() in C:\workspaces\stable-2.3.x\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\LinuxHyperVEngine.cs:line 60— End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

Another Options I tried

Make sure selected ‘Enabling ‘Hyper-V’ windows features’ option while installation of Docker

I uninstalled Docker again and tried to installed it with different options. Then I found its issue with virtualization feature of Windows Virtual Machine on which I was trying to install Docker. I made sure to myself about below option, I was selecting ‘Enable Hyper-V Windows Features’ which installation of Docker.

Enable Hyper-V on Windows Virtual Machine

  • 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 I restarted Virtual Machine, Docker auto started normally.

After all this and other small configuration changes as well it didn’t worked for me. I was getting same error as soon as I try to shift to Linux containers.

Solution

After some hours of R&D I tried to install another higher version of Windows 10 it didn’t worked. But lastly when I tried old version of Azure Windows Virtual Machine (Windows 10 version 1903). It worked for me perfectly and I am able to work on Docker with Linux containers as below.

This issue got resolved with below OS version.

After Installation I checked that virtualization is also Enabled.

Right click on Task Bar -> Task Manager -> Go To Performance Tab -> See option below with “Virtualization = Enabled”

I hope this details will help you to resolve your issues with Docker on Windows with Linux containers.

You can also below options.

https://docs.microsoft.com/en-us/azure/virtual-machines/windows/nested-virtualization

if your issue still exists then you can contact me, so i can help you to resolve it on priority. You can contact me on abhijitk914@gmail.com

Note : Make Sure you are using slighter bigger Virtual Machine Size. I am using D3V4 , you can use same or higher VM size. If you are using lower size of VM then you may face same issue again.

(Visited 10 times, 1 visits today)