docker / machine

Machine management for a container-centric world
https://docs.docker.com/machine/
Apache License 2.0
6.63k stars 1.97k forks source link

Creating VirtualBox machine no longer works after rc4 #2136

Closed dracan closed 8 years ago

dracan commented 9 years ago

Since grabbing the latest version (rc4), I now get this output when trying to create a machine ...

PS C:> docker-machine create default -d virtualbox Creating CA: C:\Users\Dan.docker\machine\certs\ca.pem Creating client certificate: C:\Users\Dan.docker\machine\certs\cert.pem Running pre-create checks... Creating machine... Waiting for machine to be running, this may take a few minutes... Machine is running, waiting for SSH to be available... Detecting operating system of created instance... Provisioning created instance... Copying certs to the local machine directory... Copying certs to the remote machine... Setting Docker configuration on the remote daemon... WARNING >>> 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. To see how to connect Docker to this machine, run: C:\Program Files\Docker Toolbox\docker-machine.exe env default

(see the first line in the quote above for the command I'm using)

This is on Windows 10, and I've seen this happen on two machines - my work machine, and my personal laptop.

I've tried deleting my entire .docker folder and all VirtualBox machines, but it doesn't make a difference. I don't have any VirtualBox hostonly interfaces other than the default VirtualBox one.

No machines seem to have been created in VirtualBox after this command fails.

dracan commented 9 years ago

Although strangely, I've just tried reverting to rc2 (I couldn't use rc3 due to #2093), but it's still doing it. Strange that I've seen it on both my work machine (yesterday) and my personal laptop (today) after upgrading to rc4 though. Are there any caches stored anywhere other than the <user>\.docker folder?

kunalkushwaha commented 9 years ago

I am facing similar problem on Windows 7 + VirtualBox 5.0.6. The issue is multiple Host-Only networks get created. and Multiple docker machines have same ip 192.168.99.100

Only way, I am able to fix it by retstarting the machine to restart VirtualBox service. Also before restarting machine, delete newly created hostonly network.

I started using Docker machine recently so canot confirm the behaviour on older versions, but I found this issue on rc3 and rc4

kunalkushwaha commented 9 years ago

I think this problem was faced with earlier builds too. https://github.com/docker/machine/issues/1996

dracan commented 9 years ago

This isn't the same issue as I'm seeing. I only have one Docker Machine, and there aren't any VirtualBox host only network interfaces created.

nathanleclaire commented 9 years ago

@kunalkushwaha @dracan Can you all please both make a gist.github.com of the output of running docker-machine --debug create -d virtualbox default? It will help immensely with fixing this bug since we will be able to see the conditions in our parsing of the VirtualBox command output that cause Machine to go sideways.

If you can get it in today, even better as the release is planned for tomorrow :)

appelgriebsch commented 9 years ago

I got an error when this call is issued to VirtualBox:

(default) DBG | COMMAND: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe modifyvm default --natpf1 delete ssh (default) DBG | STDOUT: (default) DBG | { (default) DBG | } (default) DBG | STDERR: (default) DBG | { (default) DBG | VBoxManage.exe: error: Code E_INVALIDARG (0x80070057) - One or more arguments are invalid (extended info not available) (default) DBG | VBoxManage.exe: error: Context: "RemoveRedirect(Bstr(ValueUnion.psz).raw())" at line 1767 of file VBoxManageModifyVM.cpp (default) DBG | }

kunalkushwaha commented 9 years ago

Please find output of docker-machine --debug create -d virtualbox default https://gist.github.com/kunalkushwaha/de636308da3767511f6f

nathanleclaire commented 9 years ago

@kunalkushwaha Please try clearing all host-only networks and attempting the 0.5.0 release when you get a chance.

kunalkushwaha commented 9 years ago

It is still reproducible.

Steps to reproduce this error.

  1. Clean all host only network - Keep only default one.
  2. Put Windows 7 machine on sleep.
  3. Activate Windows machine .
  4. docker-machine --debug create -d virtualbox default
    • This creation process creates two more host-only networks in VirtualBox.

NOTE: If windows start with fresh boot, Until, windows dont go into sleep mode, this error does not occur.

https://gist.github.com/kunalkushwaha/95fdc4e9e6d5328bc8e1

dracan commented 9 years ago

Sorry for the huge delay in getting you the output of my command. Below is the debug output. This is with the very latest 1.5.0 version.

This was run when I had no machines, I've deleted my .docker directory, and I've cleared all host only networks in VirtualBox.

One point to note is that the hostonly interface that gets created in virtualbox is called 'VirtualBox Host-Only Ethernet Adapter #3'. I can't find a way of resetting this #3 postfix. I wonder if this is the issue? Is Docker Machine expecting the name without it? The output below suggests that's the case.

PS C:\Scripts\docker> docker-machine --debug create -d virtualbox default
Docker Machine Version: 0.5.0 (04cfa58)
Found binary path at C:\Program Files\Docker Toolbox\docker-machine-driver-virtualbox.exe
Launching plugin server for driver virtualbox
Plugin server listening at address 127.0.0.1:61543
() Calling RpcServerDriver.GetVersion
Using API Version 1
() Calling RpcServerDriver.SetConfigRaw
() Calling RpcServerDriver.GetMachineName
(flag-lookup) Calling RpcServerDriver.GetCreateFlags
Making call to close connection to plugin binary
Making call to close driver server
(flag-lookup) Calling RpcServerDriver.Close
Successfully made call to close driver server
Found binary path at C:\Program Files\Docker Toolbox\docker-machine-driver-virtualbox.exe
Launching plugin server for driver virtualbox
Plugin server listening at address 127.0.0.1:61547
() Calling RpcServerDriver.GetVersion
Using API Version 1
() Calling RpcServerDriver.SetConfigRaw
() Calling RpcServerDriver.GetMachineName
(default) Calling RpcServerDriver.GetMachineName
(default) Calling RpcServerDriver.DriverName
(default) Calling RpcServerDriver.GetCreateFlags
(default) Calling RpcServerDriver.SetConfigFromFlags
Creating CA: C:\Users\DanClarke\.docker\machine\certs\ca.pem
Creating client certificate: C:\Users\DanClarke\.docker\machine\certs\cert.pem
Running pre-create checks...
(default) Calling RpcServerDriver.PreCreateCheck
(default) DBG | COMMAND: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe
(default) Calling RpcServerDriver.GetConfigRaw
(default) Calling RpcServerDriver.GetConfigRaw
Creating machine...
(default) Calling RpcServerDriver.Create
(default) OUT | Image cache does not exist, creating it at C:\Users\DanClarke\.docker\machine\cache...
(default) OUT | No default boot2docker iso found locally, downloading the latest release...
(default) OUT | Latest release for github.com/boot2docker/boot2docker is v1.9.0
(default) OUT |
(default) OUT | Downloading https://github.com/boot2docker/boot2docker/releases/download/v1.9.0/boot2docker.iso to C:\Users\DanClarke\.docker\machine\cache\boot2docker.iso...
(default) DBG | COMMAND: wmic cpu get VirtualizationFirmwareEnabled
(default) OUT | Creating VirtualBox VM...
(default) OUT | Creating SSH key...
(default) DBG | STDOUT:
(default) DBG | {
(default) DBG | VirtualizationFirmwareEnabled
(default) DBG | TRUE
(default) DBG |
(default) DBG | }
(default) DBG | Creating disk image...
(default) DBG | Creating 20000 MB hard disk image...
(default) DBG | COMMAND: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe createvm --basefolder C:\Users\DanClarke\.docker\machine\machines\default --name default --register
(default) DBG | STDOUT:
(default) DBG | {
(default) DBG | Virtual machine 'default' is created and registered.
(default) DBG | UUID: 6a67d65b-6453-41ed-be19-90131c7a9d2b
(default) DBG | Settings file: 'C:\Users\DanClarke\.docker\machine\machines\default\default\default.vbox'
(default) DBG | }
(default) DBG | STDERR:
(default) DBG | {
(default) DBG | }
(default) DBG | VM CPUS: 1
(default) DBG | VM Memory: 1024
(default) DBG | COMMAND: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe modifyvm default --firmware bios --bioslogofadein off --bioslogofadeout off --bioslogodisplaytime 0 --biosbootmenu disabled --ostype Linux26_64 --cpus 1 --memory 1024 --acpi on --ioapic on --rtcuseutc on --natdnshostresolver1 off --natdnsproxy1 off --cpuhotplug off --pae on --hpet on --hwvirtex on --nestedpaging on --largepages on --vtxvpid on --accelerate3d off --boot1 dvd
(default) DBG | STDOUT:
(default) DBG | {
(default) DBG | }
(default) DBG | STDERR:
(default) DBG | {
(default) DBG | }
(default) DBG | COMMAND: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe modifyvm default --nic1 nat --nictype1 82540EM --cableconnected1 on
(default) DBG | STDOUT:
(default) DBG | {
(default) DBG | }
(default) DBG | STDERR:
(default) DBG | {
(default) DBG | }
(default) DBG | using 192.168.99.6 for dhcp address
(default) DBG | COMMAND: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe list hostonlyifs
(default) DBG | STDOUT:
(default) DBG | {
(default) DBG | }
(default) DBG | STDERR:
(default) DBG | {
(default) DBG | }
(default) DBG | COMMAND: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe hostonlyif create
(default) DBG | STDOUT:
(default) DBG | {
(default) DBG | Interface 'VirtualBox Host-Only Ethernet Adapter' was successfully created
(default) DBG | }
(default) DBG | STDERR:
(default) DBG | {
(default) DBG | 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
(default) DBG | }
(default) DBG | COMMAND: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe hostonlyif ipconfig VirtualBox Host-Only Ethernet Adapter --ip 192.168.99.1 --netmask 255.255.255.0
(default) DBG | STDOUT:
(default) DBG | {
Error creating machine: Error in driver during machine creation: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe hostonlyif ipconfig VirtualBox Host-Only Ethernet Adapter --ip 192.168.99.1 --netmask 255.255.255.0 failed:
VBoxManage.exe: error: The host network interface with the given name could not be found
VBoxManage.exe: error: Details: code E_INVALIDARG (0x80070057), component HostWrap, interface IHost, callee IUnknown
VBoxManage.exe: error: Context: "FindHostNetworkInterfaceByName(Bstr(pszName).raw(), hif.asOutParam())" at line 205 of file VBoxManageHostonly.cpp
rawkode commented 9 years ago

@nathanleclaire Gist out debug output after upgrading to 0.5 and clearing all host only network interfaces

https://gist.github.com/rawkode/fecb665d3a2598fc3b09

nathanleclaire commented 9 years ago

Thanks for following up @dracan @rawkode will take a look.

rawkode commented 8 years ago

Is there anything else I can provide that will help debug this? Or do you have an idea of what it might be and I could investigate further myself?

appelgriebsch commented 8 years ago

For me it helped to update to latest Virtualbox 5.0.10 on my machine and install a fresh copy of the docker toolbox...

rawkode commented 8 years ago

It worked on my machine when I done this, but failed on two of my colleagues machines. Whatever the problem is, it appears to be rather fickle :8ball:

nathanleclaire commented 8 years ago

@rawkode If you could Gist the debug output in the failing cases it would be great. We might not be able to fix it right away but we're always looking for extra information on host system state to add for our tests (which we are currently beefing up).

gregory commented 8 years ago

https://gist.github.com/gregory/3b3c4768df89adb3780d

docker-machine 0.5.1 worked latest version of VirtualBox(5.0.10r104061)

caleb-allen commented 8 years ago

Having this issue as well.

nathanleclaire commented 8 years ago

@gregory As mentioned in the error line https://gist.github.com/gregory/3b3c4768df89adb3780d#file-debug-docker-machine-L202, you have conflicting / invalid host only interfaces. I'd recommend removing all of them that you can from the VirtualBox GUI -- (in menu bar: VirtualBox => Preferences => Network => Host-only networks). In your case, looks like vboxnet3 and vboxnet5 are the troubled ones.

nathanleclaire commented 8 years ago

@caleb-allen Please remove any existing machines and post output of docker-machine --debug create default for us to take a look at. Make sure to use Machine 0.5.2.

caleb-allen commented 8 years ago

@nathanleclaire removing the invalid host only interfaces from VirtualBox did the trick.

nathanleclaire commented 8 years ago

Nice to hear @caleb-allen. Maybe in the future we can do so automatically, but I think it's hard to do safely.

nathanleclaire commented 8 years ago

Closing this issue since OP (@dracan) has not checked in for a while.

jimitbhalanigsn commented 8 years ago

I am facing a similar problem. issue #2497

zhangcheng-aa commented 8 years ago

Clearing all host-only networks and $HOME/.docker folder does the trick for me.

rawkode commented 8 years ago

I feel rather silly now, but in-case anyone else is daft enough to not realise:

This stopped working for me because docker-machine creates VM's on the same subnet as our internal network (192.168.99) - --virtualbox-hostonly-cidr "192.168.90.1/24" helps :+1:

gpike commented 8 years ago

I had the same problem followed the suggestion above from @zhangcheng-aa, worked great.

aarsilv commented 8 years ago

Hit same problem recreating a machine with same name but more memory. Following advice from @zhangcheng-aa worked for me too.

yattias commented 8 years ago

@zhangcheng-aa fix did the trick.

jayfresh commented 8 years ago

Just adding to the mix here, having tried most things @rawkode's fix worked for me. Windows 10, recently everything broke, and this has got me up and running again.

Incidentally, contrary to past experience and lots of comments, having multiple host-only adaptors didn't cause an issue after having created the vm with the --virtualbox-hostonly-cidr "192.168.90.1/24" flag.

So the full command is: docker-machine create -d virtualbox --virtualbox-hostonly-cidr "192.168.90.1/24" default.

rmcsharry commented 8 years ago

I get this problem on a regular basis. I delete the docker machine, recreate it, then a few days later the problem reappears.

Debug output is here

Ajeet-Ganga commented 8 years ago

FWIW: If you have a VPN client running, try to turn it off and then try. Thats what worked for me.

git-msp commented 8 years ago

As said by Ajeet-Ganga if system is connected to any VPN, first disconnect it and do below

If you are using Docker Quickstart Terminal relauch it If you are using Kitematic again use:Delete VM and retry setup

But that is not the root solution, need to check how it can be resolved infact when its connected to VPN...

petermikitsh commented 8 years ago

Disconnecting from VPN solved this problem for me. Thanks for the suggestion, @Ajeet-Ganga!

git-msp commented 8 years ago

Are you able to connect infact, when vpn is connected, if so please share fix details i will try with my system

justlaputa commented 7 years ago

I'm facing the same issue in Arch Linux with virtualbox 5.1.10 r112026. I share my situation and solution in case anyone still not getting it resolved.

First please check your hostonly network, if it does not have any ip address, then you met same problem as me.

$ ip addr
...
4: vboxnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 0a:00:27:00:00:00 brd ff:ff:ff:ff:ff:ff

In my case, the hostonly network was created but there is no IP address assigned to it, which cause it can not route from host to guest vm. Here is my solution:

Add ip address manually to your hostonly network, assume you use default cidr:

$ sudo ip addr add 192.168.99.1/24 dev vboxnet0
$ ip addr
4: vboxnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 0a:00:27:00:00:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.99.1/24 scope global vboxnet0
       valid_lft forever preferred_lft forever
    inet6 fe80::800:27ff:fe00:0/64 scope link
       valid_lft forever preferred_lft forever

and the route will automatically be added:

$ ip route
default via xxx.xxx.xxx.xxx dev eno1 proto static metric 202
192.168.99.0/24 dev vboxnet0 proto kernel scope link src 192.168.99.1

then docker-machine can connect to the guest vm. Hope it helps.

RubenHoms commented 7 years ago

Faced the same scenario as @justlaputa (Arch Linux, virtualbox 5.1.22 r115126, docker-machine 0.11.0) however the scenario was a little different for me. Not only was the IP address not assigned, the vboxnet0 interface was DOWN as well. I fixed this by running sudo ip link set dev vboxnet0 up and then assigning an IP address.

benjazehr commented 6 years ago

For those with a firewall in place, maybe you'll have to open the port 2376: sudo ufw allow from any to localhost port 2376 proto tcp More on: http://www.configserverfirewall.com/ufw-ubuntu-firewall/ubuntu-firewall-open-port/

Erokos commented 5 years ago

Hi, I'm using the latest version of Docker Toolbox 18.03.0-ce and latest VB version on Windows 7. Up until yesterday when I connected to a remote host using VPN I didn't have any problems but since then I've experienced the same errors. I've unistalled, deleted and installed again everything related to the toolbox and VB but nothing helps. I've also tried a number of different solutions found here and on: https://github.com/docker/toolbox/issues/537 but nothing helps. I went to the VB GUI and saw that for the machine running, the Adapter 2 was host-only. I changed that to NAT and then the output of docker version was:

Client: Version: 18.03.0-ce API version: 1.37 Go version: go1.9.4 Git commit: 0520e24302 Built: Fri Mar 23 08:31:36 2018 OS/Arch: windows/amd64 Experimental: false Orchestrator: swarm error during connect: Get https://192.168.99.100:2376/v1.37/version: dial tcp 192.168.99.100:2376: 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.

which is better than before but still it doesn't work.... Please provide any info if you can...