Machine in Docker eventually adopts host IP address

When I create my docker machines, I assign them a specific MAC address and then use a DHCP reservation on my router to give them the same IP address every time. This works great… For a while.

Eventually, after a few shutdowns and restarts, this stops working and when I run docker-machine ls, I’ll get a response like the one below and I can no longer connect to the machine.

main - hyperv Running tcp:// Unknown Unable to query docker version: Get dial tcp connectex: No connection could be made because the target machine actively refused it.

In this case, the docker machine should have IP address is the IP address of the host machine.

I’ve not found a way to repair this issue. I simply have to remove the machine and recreate it from scratch.

I’m using hyperv and I have an external virtual switch created.

My version info is:

 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        e68fc7a
 Built:             Tue Aug 21 17:21:34 2018
 OS/Arch:           windows/amd64
 Experimental:      false

  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       e68fc7a
  Built:            Tue Aug 21 17:29:02 2018
  OS/Arch:          linux/amd64
  Experimental:     false

Thanks for any help anyone can offer on this.

I’ve identified the problem, in case anyone is wondering. This is a wifi issue. If you connect to your router by wifi and do IP reservations by mac address, it picks up the mac address of the host, not of the VM. It then assigns the VM the host’s reserved IP instead of the one reserved for the VM.
On a wired network, this is not the case.

1 Like