0

While using DockerDesktop on an EC2 Windows2019 server instance, when i am switching to Linux Containers, I am getting the crash error message for my Linux container. Its mostly because, it is unable to start the Linux VM, which would act as a host for linux containers.Below are the error details:

Docker.Core.DockerException:
Docker.Core.Backend.BackendDestroyException:
Unable to start Hyper-V VM: 'DockerDesktopVM' failed to start.

Failed to start the virtual machine 'DockerDesktopVM' because one of the Hyper-V components is not running.

'DockerDesktopVM' failed to start. (Virtual machine ID 5588BC04-4884-4DED-9C09-6BAC17537898)

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 5588BC04-4884-4DED-9C09-6BAC17537898).
at Start-MobyLinuxVM, <No file>: line 688
at <ScriptBlock>, <No file>: line 811
   at Docker.Backend.ContainerEngine.Linux.Start(Settings settings, String daemonOptions, Credential credential)
   at Docker.Backend.BackendNamedPipeServer.<Run>b__8_2(Object[] args)
   at Docker.Core.Pipe.NamedPipeServer.<>c__DisplayClass9_0.<Register>b__0(Object[] parameters)
   at Docker.Core.Pipe.NamedPipeServer.RunAction(String action, Object[] parameters)

  System.Management.Automation.RuntimeException:
  Unable to start Hyper-V VM: 'DockerDesktopVM' failed to start.

Failed to start the virtual machine 'DockerDesktopVM' because one of the Hyper-V components is not running.

  'DockerDesktopVM' failed to start. (Virtual machine ID 5588BC04-4884-4DED-9C09-6BAC17537898)

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 5588BC04-4884-4DED-9C09-6BAC17537898).
  at Start-MobyLinuxVM, <No file>: line 688
  at <ScriptBlock>, <No file>: line 811
     at Docker.Backend.ContainerEngine.Linux.DoStart(Settings settings, String daemonOptions, Credential credential)
     at Docker.Backend.ContainerEngine.Linux.Start(Settings settings, String daemonOptions, Credential credential)

     Microsoft.HyperV.PowerShell.VirtualizationException:
     'DockerDesktopVM' failed to start.

Failed to start the virtual machine 'DockerDesktopVM' because one of the Hyper-V components is not running.

     'DockerDesktopVM' failed to start. (Virtual machine ID 5588BC04-4884-4DED-9C09-6BAC17537898)

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 5588BC04-4884-4DED-9C09-6BAC17537898).

         Microsoft.Virtualization.Client.Management.VirtualizationOperationFailedException:
         'DockerDesktopVM' failed to start.

Failed to start the virtual machine 'DockerDesktopVM' because one of the Hyper-V components is not running.
            at Microsoft.Virtualization.Client.Management.View.EndMethodReturnInternal(IVMTask task, VirtualizationOperation operation, Boolean affectedElementExpected)
            at Microsoft.Virtualization.Client.Management.VMComputerSystemBaseView.EndSetState(IVMTask setStateTask)
            at Microsoft.HyperV.PowerShell.ExtensionMethods.OperationWatcherExtensions.<>c__DisplayClass4_0`1.<ConvertActionToFunction>b__0(T x)
            at Microsoft.HyperV.PowerShell.ExtensionMethods.OperationWatcherExtensions.PerformOperationWithReturn[T](IOperationWatcher watcher, Func`1 startTaskMethod, Func`2 endTaskMethod, String taskDescription, VirtualizationObject targetObject)
            at Microsoft.HyperV.PowerShell.VirtualMachine.ChangeState(VirtualMachineAction action, IOperationWatcher operationWatcher)
            at Microsoft.HyperV.PowerShell.Commands.StartVM.ProcessOneOperand(VirtualMachine vm, IOperationWatcher operationWatcher)
            at Microsoft.HyperV.PowerShell.Commands.VirtualizationCmdlet`1.ProcessOperands(IList`1 operands, IOperationWatcher operationWatcher)

   at Docker.Core.Pipe.NamedPipeClient.<TrySendAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Docker.Core.Pipe.NamedPipeClient.Send(String action, Object[] parameters)
   at Docker.Actions.DoStart(SynchronizationContext syncCtx, Boolean showWelcomeWindow, Boolean withNotifications)
   at Docker.Actions.<>c__DisplayClass26_0.<StartAsync>b__0()
   at Docker.ApiServices.TaskQueuing.TaskQueue.<>c__DisplayClass18_0.<.ctor>b__1()

Below are version related details:

C:\Users\Administrator>docker version
    Client: Docker Engine - Community
     Version:           19.03.8
     API version:       1.40
     Go version:        go1.12.17
     Git commit:        afacb8b
     Built:             Wed Mar 11 01:23:10 2020
     OS/Arch:           windows/amd64
     Experimental:      false

    Server: Docker Engine - Community
     Engine:
      Version:          19.03.8
      API version:      1.40 (minimum version 1.24)
      Go version:       go1.12.17
      Git commit:       afacb8b
      Built:            Wed Mar 11 01:37:20 2020
      OS/Arch:          windows/amd64
  Experimental:     false

Any help here please.

Thanks.

Aman
  • 159
  • 2
  • 15

1 Answers1

0

You can't install Docker Desktop (or Docker CE) on Windows Server. Instead, you can install the one packaged by Microsoft: https://learn.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tabs=Windows-Server

After this step, you should be able to run Windows container on Windows Server 2019, but, if you need to run Linux Container as well, you need to togle the support:

[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "1", "Machine")

Or disable it:

[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", $null, "Machine")

And restart the docker service:

Restart-Service docker

But, you need to make sure Hyper-V is enabled:

Enable-WindowsOptionalFeature –Online -FeatureName Microsoft-Hyper-V –All -NoRestart

Install-WindowsFeature RSAT-Hyper-V-Tools -IncludeAllSubFeature

And for running linux container, you need to add an extra parameter to docker run:

docker run --rm --platform linux busybox echo hello_world

If it doesn't works (because it's an experimental feature), you may check with:

docker run --rm --isolation=hyperv busybox echo hello_world
jmaitrehenry
  • 2,190
  • 21
  • 31
  • Thank you for sharing the details. Now i am able to install docker and run windows containers, however, while toggling the support using the command provided, I am still not able to run linux containers, nor do i see any LinuxVM in the Hyper-V manager. Below is the error i get while running alpine image from the hub: latest: Pulling from library/alpine C:\Program Files\Docker\docker.exe: no matching manifest for windows/amd64 10.0.17763 in the manifest list entries. – Aman Apr 30 '20 at 09:13
  • @Aman I updated my response to add two way to run linux container: using the platform parameter (but it's experimental) or by adding the hyperv isolation for your container. – jmaitrehenry May 01 '20 at 15:54
  • Even after togging to linux support and restarting the docker, i get the below error which running nginx image. `C:\Users\Administrator> docker run --isolation=hyperv nginx Unable to find image 'nginx:latest' locally latest: Pulling from library/nginx C:\Program Files\Docker\docker.exe: no matching manifest for windows/amd64 10.0.17763 in the manifest list entries. See 'C:\Program Files\Docker\docker.exe run --help'.` – Aman May 01 '20 at 18:07
  • Did you try with the platform parameter as well? As far as I know, the Linux Container on Windows (and windows server) is still experimental. – jmaitrehenry May 01 '20 at 18:14
  • --platform option is not working either. i tried removing Docker CE and switch to Docker EE installation with the below commands: `Install-Module DockerProvider Install-Package Docker -ProviderName DockerProvider -RequiredVersion preview` However, while running the linux containers, it is unable to start the embedded linux virtualbox. Below is the error for the same. `C:\Program Files\Docker\docker.exe: failed to register layer: failed to start service utility VM. The virtual machine could not be started because a required feature is not installed. (0xc0370102)` – Aman May 01 '20 at 18:50