Jul 07, 2016

Troubleshooting Docker Issues on Hyper-V in Windows 10

Recently, I decided to setup Docker on my Windows 10 machine and saw two options available:

Docker for Windows

Docker Toolbox

Docker for Windows looks more promising (but it is currently in public beta). It runs as a native Windows application and uses Hyper-V to virtualize the Docker Engine environment and Linux kernel-specific features for the Docker daemon.

As in the documentation, it looks very easy, enable Hyper-V on Windows, download Docker msi and install it. But on developer machine, it is not so simple :) This post covers some issues and their solutions.

First thing, to check log, open following path in Windows:

%LOCALAPPDATA%\Docker

Here you will get date-wise log files.

Error: Unable to execute Stop: Failed to stop "MobyLinuxVM": 'MobyLinuxVM' failed to change state.

[22:36:51.236][ProxyProcess ][Debug ] com.docker.slirp.exe: ARP responding to: who-has 192.168.65.1?

[22:41:55.481][NamedPipeServer][Error ] Unable to execute Stop: Failed to stop "MobyLinuxVM": 'MobyLinuxVM' failed to change state. at System.Management.Automation.Interpreter.ThrowInstruction.Run(InterpretedFrame frame)

at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)

1. In the Docker settings, use the default IP: 10.0.75.0 and subnet mask 255.255.255.0

Docker Windows Network Settings

2. Make sure port 53 is not used by any other application. To check this, run following command

netstat -aon | findstr :"53"

You can get PID (Process Id) from above command. Run following command to get details from PID

tasklist /SVC | findstr

OR

In Task Manager, Details tab, you can find the process with the PID.

3. Remove/Disable all internal Hyper-v switches and other adapters (if you can).

Docker Windows Network Settings

4. Remove all other Hyper V virtual machines except the Docker owned.

5. If an external USB Network adapter connected, remove it and use built in adapter.

6. Disable IPv6 for DockerNet

vEthernet (DockerNAT) properties > Uncheck "Internet Protocol Version 6(TCP/IP)"

Docker Windows Network Settings

7. In the Docker Settings > Reset > click "Reset to factory defaults..".

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

Reason:

Open Hyper-V Manager, the VM is running but it doesn't have an IP in the networking session.

Docker Windows Network Settings

In the Docker Settings > Reset > click "Reset to factory defaults.." and try again.

If still exists, check Windows error log

In the Run box(Windows + R), type eventvwr to open Event Viewer, In Windows Log > Application, check if any error message.

Are you getting following WMI error?

Event filter with query "SELECT * FROM __InstanceOperationEvent WITHIN 10 WHERE (TargetInstance ISA 'Msvm_ExternalEthernetPort') OR (TargetInstance ISA 'Msvm_VmLANEndpoint') OR (TargetInstance ISA 'Msvm_SyntheticEthernetPort') OR (TargetInstance ISA 'Msvm_ComputerSystem')" could not be reactivated in namespace "//./root/virtualization" because of error 0x80041010. Events cannot be delivered through this filter until the problem is corrected.

On googling, I found the problem is due to network driver. Someone resolved by deleting the Intel 82579LM Gigabit Network adapter in the Windows Device Manager and reinstalling it with Windows default network driver.

If you have any additional network driver installed, uninstall it and run it again.

Note: Reboot is necessary to reinstall network drivers.

You can get process id in the error details in Event Viewer and check the associated application for the process id in Task Manager. If it is different application, uninstall it and try again.

ERROR: Error while pulling image: Get https://index.docker.io/v1/repositories/library/mysql/images: dial tcp: lookup index.docker.io on 192.168.65.1:53: server misbehaving

In Docket settings > Network > Set DNS Server Fixed: 8.8.8.8 and Reset > Restart docker.

Hope, It helps and saves your time. Do share your opinion to resolve the issue in comment box.