janeczku / docker-machine-vultr

:m: Docker Machine driver for Vultr Cloud
MIT License
192 stars 25 forks source link

Failed to create Vultr host as the Public IP of the server became '0.0.0.0' #18

Closed twang2218 closed 7 years ago

twang2218 commented 7 years ago

It used to work, but during my test today, I found docker-machine create -d vultr failed to create a Vultr host.

 docker-machine create -d vultr v1
Running pre-create checks...
(v1) Validating Vultr VPS parameters...
(v1) getting client
(v1) getting client
(v1) getting client
Creating machine...
(v1) getting client
(v1) Creating Vultr VPS...
(v1) getting client
(v1) Waiting for IP address to become available...
(v1) Created Vultr VPS ID: 6472698, Public IP: 0.0.0.0, Private IP:
Waiting for machine to be running, this may take a few minutes...
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
(v1) getting client
Detecting operating system of created instance...
Waiting for SSH to be available...
Password:

It began to ask me the password, which should never happen. The SSH key should has been set up already.

geneticgrabbag commented 7 years ago

Since I don't see an OS specified in your message, can I assume it's deploying RancherOS?

twang2218 commented 7 years ago

@geneticgrabbag Oh, I'm sorry that I forgot providing the environment variables for the vultr driver. Here it is:

#!/bin/bash
# Install Vultr Driver: https://github.com/janeczku/docker-machine-vultr

export VULTR_API_KEY=<API_KEY>

# 1  - New Jersey
# 12 - Silicon Valley
# 19 - Sydney
# 25 - Tokyo
export VULTR_REGION=12

# Plan 29 - 768 MB RAM,15 GB SSD
export VULTR_PLAN=29

# 160 - Ubuntu 14.04 x64
# 215 - Ubuntu 16.04 x64
# 167 - CentOS 7 x64
export VULTR_OS=215

# IPv6
# export VULTR_IPV6=true

export MACHINE_DRIVER=vultr

Everytime I create a vultr host, I source this file first.

So, I was creating 768MB/15GB host with Ubuntu 16.04 OS in the Silicon Valley region.

geneticgrabbag commented 7 years ago

@twang2218 ah, thanks.

i tried duplicating it and I get this:

% docker-machine create -d vultr -vultr-api-key=$VULTR_TOKEN --vultr-region-id=12 --vultr-os-id=215 --vultr-plan-id=29 v1
Running pre-create checks...
(v1) Validating Vultr VPS parameters...
Creating machine...
(v1) Creating Vultr VPS...
(v1) Waiting for IP address to become available...
(v1) Created Vultr VPS ID: 6475856, Public IP: 0.0.0.0, Private IP:
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Error creating machine: Error detecting OS: Too many retries waiting for SSH to be available.  Last error: Maximum number of retries (60) exceeded

I can log in via the Vultr console, but it fails with an SSH call from my terminal:

% ssh root@<ip-address>
Received disconnect from <ip-address>: 2: Too many authentication failures
Disconnected from <ip-address>
twang2218 commented 7 years ago

The version of my vultr driver was 1.0.6, and I updated to the latest, 1.1.0, the problem is same, here is the output with --debug option:

$ docker-machine --debug create -d vultr v1
Docker Machine Version:  0.9.0-rc2, build 7b19591
Found binary path at /usr/local/bin/docker-machine-driver-vultr
Launching plugin server for driver vultr
Plugin server listening at address 127.0.0.1:60469
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(flag-lookup) Calling .GetMachineName
(flag-lookup) Calling .DriverName
(flag-lookup) Calling .GetCreateFlags
Found binary path at /usr/local/bin/docker-machine-driver-vultr
Launching plugin server for driver vultr
Plugin server listening at address 127.0.0.1:60473
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(v1) Calling .GetMachineName
(v1) Calling .DriverName
(v1) Calling .GetCreateFlags
(v1) Calling .SetConfigFromFlags
Running pre-create checks...
(v1) Calling .PreCreateCheck
(v1) Validating Vultr VPS parameters...
(v1) Calling .GetConfigRaw
Creating machine...
(v1) Calling .Create
(v1) DBG | Generating SSH key...
(v1) Creating Vultr VPS...
(v1) Waiting for IP address to become available...
(v1) Created Vultr VPS ID: 6475975, Public IP: 0.0.0.0, Private IP:
(v1) Calling .GetConfigRaw
(v1) Calling .DriverName
(v1) Calling .DriverName
Waiting for machine to be running, this may take a few minutes...
(v1) Calling .GetState
(v1) Calling .GetState
(v1) Calling .GetState
(v1) Calling .GetState
(v1) Calling .GetState
(v1) Calling .GetState
(v1) Calling .GetState
(v1) Calling .GetState
(v1) Calling .GetState
(v1) Calling .GetState
(v1) Calling .GetState
(v1) Calling .GetState
(v1) Calling .GetState
(v1) Calling .GetState
(v1) Calling .GetState
Detecting operating system of created instance...
Waiting for SSH to be available...
Getting to WaitForSSH function...
(v1) Calling .GetSSHHostname
(v1) Calling .GetSSHPort
(v1) Calling .GetSSHKeyPath
(v1) Calling .GetSSHKeyPath
(v1) Calling .GetSSHUsername
Using SSH client type: external
Using SSH private key: /Users/taowang/.docker/machine/machines/v1/id_rsa (-rw-------)
&{[-F /dev/null -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none root@0.0.0.0 -o IdentitiesOnly=yes -i /Users/taowang/.docker/machine/machines/v1/id_rsa -p 22] /usr/bin/ssh <nil>}
About to run SSH command:
exit 0
Password:

I think the reason is that Public IP is returned 0.0.0.0:

(v1) Created Vultr VPS ID: 6475975, Public IP: 0.0.0.0, Private IP:

So, that cause the ssh command is actually trying to connect to my laptop root@0.0.0.0. 😹

&{[-F /dev/null -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none root@0.0.0.0 -o IdentitiesOnly=yes -i /Users/taowang/.docker/machine/machines/v1/id_rsa -p 22] /usr/bin/ssh <nil>}

Is there any API changes cause the problem?

geneticgrabbag commented 7 years ago

@twang2218 - I can confirm the attempt to SSH as root into 0.0.0.0. I'm using driver v1.1.0 with docker machine v0.8.2 on OS/X v10.11.6.

jukkagrao commented 7 years ago

Same problem with Public IP: 0.0.0.0 it has worked before on same system

dmitrym0 commented 7 years ago

Thanks for a wonderful plugin. It doesn't seem like it's been released yet. I tried to build it myself, but I"m not familiar with Go, so I failed. Is there any way to extract a build artifact from CircleCI?

jukkagrao commented 7 years ago

Hi dmitrym0, there is my build for linux based system http://file.sampo.ru/q86239/ (tested on ubuntu)

janeczku commented 7 years ago

@dmitrym0 New release is out, enjoy! https://github.com/janeczku/docker-machine-vultr/releases/tag/v1.2.0

bfosberry commented 7 years ago

Came across this, thanks for fixing!

dmitrym0 commented 7 years ago

Thank you so much, works great! 👍