Docker Community Forums

Share and learn in the Docker community.

Machine in Docker eventually adopts host IP address


(Pdavis68) #1

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://10.95.153.101:2376 Unknown Unable to query docker version: Get https://10.95.153.101:2376/v1.15/version: dial tcp 10.95.153.101:2376: connectex: No connection could be made because the target machine actively refused it.

In this case, the docker machine should have IP address 10.95.153.123. 10.95.153.101 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:

Client:
 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

Server:
 Engine:
  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.


(Pdavis68) #2

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.