docs icon indicating copy to clipboard operation
docs copied to clipboard

"docker-machine create" using Hyper-V driver generates IPv6 address

Open samdevx1029 opened this issue 9 years ago • 23 comments

File: machine/drivers/hyper-v.md, CC @londoncalling I am not able to get the same result as advertised on this page. Instead, I get the following output.

PS C:\WINDOWS\system32> docker-machine create -d hyperv --hyperv-virtual-switch ### _"virtualSwitchAndBridge" worker2 Running pre-create checks... Creating machine... (worker2) Copying C:\Users\sshrestha.GOLO.docker\machine\cache\boot2docker.iso to C:\Users\sshrestha.GOLO.docker\machine\machines\worker2\boot2docker.iso... (worker2) Creating SSH key... (worker2) Creating VM... (worker2) Using switch "virtualSwitchAndBridge" (worker2) Creating VHD (worker2) Starting VM... (worker2) Waiting for host to start... Waiting for machine to be running, this may take a few minutes... Detecting operating system of created instance... Waiting for SSH to be available... Detecting the provisioner... Provisioning with boot2docker... Copying certs to the local machine directory... Copying certs to the remote machine... Setting Docker configuration on the remote daemon...

This machine has been allocated an IP address, but Docker Machine could not reach it successfully.

SSH for the machine should still work, but connecting to exposed ports, such as the Docker daemon port (usually :2376), may not work properly.

You may need to add the route manually, or use another related workaround.

This could be due to a VPN, proxy, or host file configuration issue.

You also might want to clear any VirtualBox host only interfaces you are not using. Checking connection to Docker... Docker is up and running! To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: C:\Program Files\Docker\Docker\Resources\bin\docker-machine.exe env worker2_

Running "docker-machine ip worker2" gives me IPv6 address ad follows. fe80::215:5dff:fe01:2213

I bounced the VM, got the same IPv6 address.

Running "docker-machine ls" gives me this error.

NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS worker2 - hyperv Running tcp://192.168.1.37:2376 Unknown Unable to query docker version: Get https://192.168.1.37:2376/v1.15/version: x50 9: certificate is valid for fe80::215:5dff:fe01:2213, not 192.168.1.37

samdevx1029 avatar Apr 01 '17 05:04 samdevx1029

You may have better luck if you set up a new external network switch, as shown here: https://docs.docker.com/machine/drivers/hyper-v/#example .

JimGalasyn avatar Apr 03 '17 17:04 JimGalasyn

@JimGalasyn thanks, exactly. @samdevx1029 please let me know if the external network switch solves your problem. (It definitely won't work without it.)

londoncalling avatar Apr 04 '17 15:04 londoncalling

Claimed,

I tried to reproduce what occurred using a fresh install with the same switch name "virtualSwitchAndBridge".

I did not reboot as the example suggested to see if maybe this is what caused the issue reported. This did not get me hung up on "waiting for vm to start" as the example alluded to. Everything in the example worked without any issues and I was able to create all three machines.

After removing all three machines I started over.

I set the virtual switch to "internal" and received the same error reported in this issue

"This machine has been allocated an IP address, but Docker Machine could not reach it successfully."

It also received an IPv6 address as reported in "docker-machine ip", but I did not see an IPv4 address when running "docker-machine ls" like this issue, so that was the only difference.

I then tried the virtual switch to "private" and it got hung up on

"Waiting for SSH to be available…"

Even though in Hyper-V manager I can see worker1 was created and it has an address, I gave up waiting after several minutes and cancelled command. "docker-machine ls" also produced a "timeout" state for this machine. The machine was removed without an issue.

I then set the virtual switch back to "external" and was able to create all three machines again without any issues.

So I would say this can be closed.

nopsnek avatar Apr 21 '17 14:04 nopsnek

@stevenhanna6 Thank you for the thorough test to try to reproduce. Sounds exactly right to me, and validates our Hyper-V instructions to create the external network switch. How about this .. Can you create a PR to add a couple of things to possibly help avoid this problem in future? (Either way, we'll credit you the full points for this issue.)

Below are my ideas for making this clearer without too much heaviness, but if you have others, please suggest.

  1. Bold the phrase external network switch in the sentence under the first screen snap, as follows: "Set up a new external network switch to use instead of DockerNAT network switch (for Moby), which is set up by default when you install Docker for Windows. (Or if you already have another network switch set up, you can use that one.)"

  2. Extend the parenthetical remark at the end of that sentence as follows: (Or if you already have another network switch set up, you can use that one, but it must be an external switch.)

londoncalling avatar Apr 21 '17 19:04 londoncalling

I put bold on the last external word as well, should be clear as day now.

nopsnek avatar Apr 21 '17 19:04 nopsnek

@stevenhanna6 Beautiful! 🙂 👍

londoncalling avatar Apr 21 '17 20:04 londoncalling

Points to @stevenhanna6 for the work to thoroughly test this, and improve the note.

londoncalling avatar Apr 24 '17 21:04 londoncalling

I've got the exact same issue. Running on Windows 10 - Hyper V.

docker-machine creates machines with IPv6 - this is whilst the host uses IPv4 and they don't find each other. The context is - I've been trying to setup a swarm with one manager (IPv4) and three workers (IPv6 - expectedly..).

rikkigouda avatar Apr 10 '18 13:04 rikkigouda

I have a similar problem. I followed the tutorial at https://docs.docker.com/get-started/part4/#understanding-swarm-clusters and created an external virtual switch and then created a VM with docker-machine create -d hyperv -hyperv-virtual-switch "myswitch" myvm1 Works fine. However, the IP address of myvm1 is IPv6 and when I try to set the VM as a manager with docker-machine ssh myvm1 "docker swarm init --advertise-addr [fe80::215:5dff:fe0c:3725]" I get the error message: "Error response from daemon: advertise address must be a non-zero IP address or network interface (with optional port number)"

mafritsch avatar Aug 28 '18 12:08 mafritsch

@mafritsch can you do me a favor and take a screen snap of your Virtual Switch Manager to verify that the switch you created was on an external network as shown on the screen snap in this example? We've tested this several times, and never been able to reproduce the problem except when the switch is created on an internal network (per previous comments on this thread).

I'll work through the example again later tonight, as well, to see if it's still working for me.

londoncalling avatar Aug 28 '18 22:08 londoncalling

Sure thing: image

mafritsch avatar Aug 29 '18 08:08 mafritsch

@mafritsch thanks for the screen snap, I got swamped with work (not at Docker anymore) and I had to install Windows 10 on VirtualBox, but I'll walk through the procedures again tonight and see if I can reproduce your problem.

londoncalling avatar Aug 30 '18 18:08 londoncalling

hi @londoncalling @mafritsch did you get the Topic solved? I'm running on the same Situation here. I'm trying to carry out the swarm sample/tutorial for docker. I've created the virtual Switch (external type) and 2 virtual machines running boot2docker. However when I issue a docker-machine ls I get such ips tcp://[fe80::215:5dff:fe5d:9126]:2376 and both vms Display an error

Unable to query docker version: Get https://[fe80::215:5dff:fe5d:9126]:2376/v1.15/version: dial tcp [fe80::215:5dff:fe5d:9126]:2376: connectex: A socket operation was attempted to an unreachable network

Here's how my virtual Switch Looks like: image

munozm01 avatar Jan 15 '19 10:01 munozm01

Hi @munozm01, I've never got the topic solved, sorry.

mafritsch avatar Jan 15 '19 10:01 mafritsch

I am facing similar issue even after creating external virtual switch. I am wondering if anyone was able to solve this issue.

image

image

manusebastiank avatar Jan 15 '19 14:01 manusebastiank

Anyone able to resolve this? I'm seeing the same issue with the Intel(R) Ethernet Connection I218-V. It's a little suspicious that everyone who's reporting this issue is using an Ethernet external network, so I'm guessing that's where the issue lies. But I'm not exactly sure what's going on.

yashpatel5400 avatar Mar 20 '19 17:03 yashpatel5400

@yashpatel5400 are you using OpenSSH? (see https://github.com/PowerShell/Win32-OpenSSH/issues/1155)

The external network switch is necessary (internal switch won't work). I was never able to reproduce the error. The example here is based on my walkthrough.

londoncalling avatar Mar 20 '19 23:03 londoncalling

Having the same issues also.

Not sure if this would make a difference; I am running a windows 10 VM within Hyper-V (also Windows 10) where I run docker.

So far the only difference I found is the ipv6 addresses being generated.

I had to switch on the nested virtualization on my host: Set-VMProcessor -VMName "" -ExposeVirtualizationExtensions $true

On my guest:

external network

Or do I potentially need to make changes the way I've setup my network adapter on my host?

pimbogels avatar May 02 '19 02:05 pimbogels

Stuck on the same issue. Followed the docker documentation for external switch. Any resolution?

devanshujoshi avatar May 19 '19 19:05 devanshujoshi

Since many are still stuck, as I was after following the above, your issue might = mine. I did the following and was able to get vm on Win10 to instantiate with IPv4 after I ran into same issue from part 4 where IPv6 addresses were populated when already running an EXTERNAL switch.

The solution was to switch networks and then rebuild vms! Easy and peasy! I would get IPv6 @ Starbucks but IPv4 at home.

Now with IPv4 adds, docker allows me to assign workers to swarm. Hope helps!

sleethma avatar Jun 24 '19 05:06 sleethma