Docker : Troubleshooting Installation Issues

In the earlier post, I have detailed the process of registering for private beta program and installing the beta version of Docker in Windows machine and in the last part I have mentioned that I faced some issues while initializing the Docker in my machine. In this post I am going in detail about the issues faced and the steps I took to resolve it.

After the installation, when I launched the Docker instance,it showed me an error saying that there is not enough memory to start Docker after some time.

My machine was running on Windows Insider Preview build 14295 which has got only 3 gigs of memory. So, I closed all the unwanted applications which was consuming a lot of memory and was able to bring down memory usage to 50%. 

Enabling Hypervisior

When I started the Docker again, the above error went away but got another one this time saying that the VM cannot be started because the hypervisor is not running.

I am having VMWare player installed in my machine and thought Virtualization is enabled in the BIOS. To my horror it was not and so I rebooted the machine to enable it from the BIOS. Also you need to make sure that Hyper-V is installed in your machine. With this beta version, Docker has dropped VirtualBox for hosting the VMs and instead uses Hyper-V now. 

You can check the status from Settings -> Apps & Features -> Related -> Programs and Features page. Click on the Turn Windows features on or off to bring up a dialog box which will show the features in a tree menu.

If Hyper-V is already installed, the check boxes will be selected by default as shown in the figure. Otherwise you need to the select the two items under Hyper-V and click Ok to install it

Next you need to make sure that Hypervisor is enabled and set to start automaticall when the machine boots up. Use bcdedit command to verify it and make sure that you are using an elevated command prompt for this otherwise you will get an Access Denied error. 

If it's setup properly, then it will have an entry called hypervisorlaunchtype with value set to auto or on. If it's missing, then add it by executing the following statement.

bcdedit /set hypervisorlaunchtype auto

You can also make sure that Hyper-V service is running or not from the Services window.

Invalid Startup Memory Error

When I tried to start Docker again after restarting the machine, got the same error notification but with a different message this time. The error was 

Invalid startup memory amount assigned for 'MobyLinuxVM'

I didn't had a clue about this error, up until now I haven't configured anything for Startup memory and didn't had a clue on how to solve this one. So I dig around a little with the items in the context menu which I got by right clicking on the icon in the system tray. I got the detailed error log which had the following entry in it.

[00:45:24.630][Notifications  ][Error  ] Error: Failed to create VM "MobyLinuxVM": Failed to modify device 'Memory'.

Invalid startup memory amount assigned for 'MobyLinuxVM'.

'MobyLinuxVM' failed to modify device 'Memory'. (Virtual machine ID XXXXX-XXXX-XXXX-XXXX-XXXXXXXXX)

Invalid startup memory assigned for 'MobyLinuxVM'. The maximum amount of memory you can assign to this virtual machine is '1864' MB.
(Virtual machine ID XXXXX-XXXX-XXXX-XXXX-XXXXXXXXX)

In the context menu itself, there is a menu item for Settings, which will open a dialog window from where you can configure properties such as Change VM Setting, Manage Shared Drive etc. In the Change VM Settings window, you will have the options for specifying the number of CPUs as well as the amount of RAM that will be used by VM. For me it was 2 CPUs and 2 Gigs of RAM by default and from the log I found out that I can assign only 1.8 gigs. Now I understood the error raised by Docker and so I scaled it down to 1 CPU and 1 GB as shown in the image below.

'MobyLinuxVM' failed to start Error.

This time the issue related to memory went away and got this one saying simply that the VM failed to start. I thought the previous one was frustrating until I got this one. This was like a generic one, I had a feeling that there are mulitiple issues which is causing this error making it that much difficult to resolve.

First I thought it was due to the VMWare Services that were already running in my machine. So I disabled all related to VMWare from Services window and restarted the machine to see if the issue is resolved or not.

1. Check DockertNat Virtual Switch is created or not

After the restart, I got the same error again while trying to run Docker. So I checked whether the network adapters are configured properly in VM or not. Docker creates a internal Virtual Switch called DockerNat during the installation. You can check whether it's created or not by running the Get-NetNat command from a Powershell window. Mine had only one which was created by Docker and is having the correct IP and subnet.

If your machine has got other adapters use the Remove-NetNat command to remove all those from the system. 

You can also do these steps from Virtual Switch Manager window in Hyper-V manager too 

2. Check Port#53 is available or not

The next thing I did was to check whether port number 53 is being used by some other application/services or not. Since this port number is reserved for DNS used by Docker, non-availabilty of this may cause the above issue. You can check that by running the following command in a Powershell window

netstat -aon | findstr :"53"

This will list all the matching entries with 53 in it. You can use the 

tasklist /SVS | findstr <PID> 

command to get the details about the process which is currently using that port

As you can see from the screenshot, port #53 is not being used by anyone and I can safely say that it's not causing the issue.

3. Make Sure VM is using DockerNat

Even though the DockerNat virtual switch is created, sometimes we can't gurantee that it's using the same for connectivity. Make sure that it's using by checking the VM settings from Hyper-V.

Connectivity Errors

With these steps, I finally got rid of the failed to initialize errors, but now I was getting couple of errors related to connectivity. When I checked the VM in Hyper-V, I can see that it's using the DockerNat as the network adapter, but no IP address were getting assingned. The entries in the log were

[01:01:15.650][Notifications  ][Error  ] Error: Failed to start VM "MobyLinuxVM": The VM couldn't get an IP address after 60 tries

[09:42:32.263][Proxy          ][Info   ] dial tcp 10.0.75.2:2375: connectex: 
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed
because connected host has failed to respond

So I made sure that the default gateway used by the adapter is pointing to the correct ip by running the ipconfig command as shown below. It should be pointing to 10.0.75.1

So after this what I did was from the Settings menu, I clicked on the Reset to factory Defaults link, which shut down the running Docker instance. I restarted the machine and voila the blue whale finally appeared on the system tray along with notification that it's up and running. So I went to the Hyper-V to check whether the IP Address is getting assigned or not.

Given below are the links which I referred while trying to solve and if you are also facing it, will be of great help for you

VM “MobyLinuxVM”: The VM couldn’t get an IP address after 60 tries

We'Ve Been Playing With The Docker Beta For Windows, Here Are Our Findings by Docker Saigon

Settings: Reset to default quits with Error [resolved]

Error response from daemon: dial tcp 10.0.75.2:2375: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

‘MobyLinuxVM’ failed to start. ‘MobyLinuxVM’ failed to initialize

Docker for Windows Beta announced by Scott Hanselman

             


1 Comment

  • Gravatar Image

    Thank you that damn thing finally worked...

Add a Comment