Increase timeout for "Wait for the VM to get an IP address"

I’ve recently upgraded to 1.12 which uses Hyper-V for Windows instead of virtualbox. But docker is failing to start, most of the times. It does start a few times, usually after a fresh reboot, but as I load up my dev setup, it’s impossible to start or even restart the docker.

The problem, I think is that it’s not waiting long enough because as I see the logs and it’s printing this message

[14:11:50.398][HyperV ][Info ] Wait for the VM to get an IP address

again and again. I also opened up the Hyper-V Manager to see whether the image is actually loading and while it takes some time to boot, it does boot up eventually but right before it happens, the docker-client has already decided that

[14:11:51.433][HyperV ][Info ] It’s taking too long. Let’s restart the VM…
[14:11:51.909][HyperV ][Info ] Shutdown VM MobyLinuxVM…

It happens just as I see the the docker fish logo in text displayed in Hyper-V Manager.

So I think if I could increase this limit maybe it’ll work. How can I do that?

I found it, it’s in “C:\Program Files\Docker\Docker\resources\MobyLinux.ps1” at line 376.

    if ($times -eq 120) {
        Write-Output "It's taking too long. Let's restart the VM..."

        Write-Output "Starting VM $VmName..."
        Start-VM -VMName $VmName
    } elseif ($times -eq 300) {
        Fatal "The VM couldn't get an IP address after $times tries"

Increased it to 120 and it boots perfectly now.