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

docker-machine with openstack #2316

Open yutinghgx opened 9 years ago

yutinghgx commented 9 years ago

When I create a docker-machine with openstack ,using following comand:

$ docker-machine --debug create -d openstack --openstack-username admin --openstack-password password --openstack-tenant-name admin --openstack-auth-url http://10.100.11.4:5000/v2.0 --openstack-flavor-id 682ba378-b3db-4fb6-8b1f-a1c8189e913f --openstack-image-id 5b293dd4-0a38-4cd7-851f-1106ddde619c --openstack-net-name net04 --openstack-floatingip-pool net04_ext --openstack-ssh-user root --openstack-ssh-port 22 testmachine2

The vm has been created ,but Getting to WaitForSSH function...take error "Error getting ssh command 'exit 0' : Something went wrong running an SSH command!" Please help !!!

nathanleclaire commented 9 years ago

cc @ggiamarchi

nathanleclaire commented 8 years ago

The "Something went wrong running an SSH command" error is normal in most circumstances assuming the creation goes successfully in the end (it's how we wait for the VM to be up). Please re-open if you can provide docker-machine --debug create output.

yutinghgx commented 8 years ago

Hello,when I re-execute the comand "docker-machine --debug create",the output is

Docker Machine Version: 0.5.0 (04cfa58)
Found binary path at /usr/local/bin/docker-machine-driver-openstack
Launching plugin server for driver openstack
Plugin server listening at address 127.0.0.1:52576
() 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 /usr/local/bin/docker-machine-driver-openstack
Launching plugin server for driver openstack
Plugin server listening at address 127.0.0.1:48380
() Calling RpcServerDriver.GetVersion
Using API Version 1
() Calling RpcServerDriver.SetConfigRaw
() Calling RpcServerDriver.GetMachineName
(testmachine2) Calling RpcServerDriver.GetMachineName
(testmachine2) Calling RpcServerDriver.DriverName
Host already exists: "testmachine2"
root@ubuntu:/opt# docker-machine --debug create -d openstack testmachine3
Docker Machine Version: 0.5.0 (04cfa58)
Found binary path at /usr/local/bin/docker-machine-driver-openstack
Launching plugin server for driver openstack
Plugin server listening at address 127.0.0.1:42138
() 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 /usr/local/bin/docker-machine-driver-openstack
Launching plugin server for driver openstack
Plugin server listening at address 127.0.0.1:49285
() Calling RpcServerDriver.GetVersion
Using API Version 1
() Calling RpcServerDriver.SetConfigRaw
() Calling RpcServerDriver.GetMachineName
(testmachine3) Calling RpcServerDriver.GetMachineName
(testmachine3) Calling RpcServerDriver.DriverName
(testmachine3) Calling RpcServerDriver.GetCreateFlags
(testmachine3) Calling RpcServerDriver.SetConfigFromFlags
Running pre-create checks...
(testmachine3) Calling RpcServerDriver.PreCreateCheck
(testmachine3) Calling RpcServerDriver.GetConfigRaw
(testmachine3) Calling RpcServerDriver.GetConfigRaw
Creating machine...
(testmachine3) Calling RpcServerDriver.Create
(testmachine3) DBG | Authenticating...       AuthUrl=http://10.100.11.4:5000/v2.0 DomainID= DomainName= Insecure=false TenantID= TenantName=admin Username=admin
(testmachine3) DBG | Found network id using its name         ID=6239f7aa-258f-4a66-a16e-558310fb313a Name=vlan16
(testmachine3) DBG | Creating Key Pair...        Name=testmachine3-ce01585eb4ecb85b77b6f66995dbed2a0b1003730b7f01f0fc633e11a542bba2
(testmachine3) DBG | Creating OpenStack instance...      FlavorId=682ba378-b3db-4fb6-8b1f-a1c8189e913f ImageId=5b293dd4-0a38-4cd7-851f-1106ddde619c
(testmachine3) OUT | Creating machine...
(testmachine3) DBG | Waiting for the OpenStack instance to be ACTIVE...      MachineId=61c5d8f4-8e78-480f-8540-bc7fcbef4543
(testmachine3) DBG | Looking for the IP address...       MachineId=61c5d8f4-8e78-480f-8540-bc7fcbef4543
(testmachine3) DBG | IP address found        IP=10.100.16.52 MachineId=61c5d8f4-8e78-480f-8540-bc7fcbef4543
(testmachine3) Calling RpcServerDriver.GetConfigRaw
(testmachine3) Calling RpcServerDriver.GetConfigRaw
(testmachine3) Calling RpcServerDriver.DriverName
Waiting for machine to be running, this may take a few minutes...
(testmachine3) Calling RpcServerDriver.GetState
(testmachine3) DBG | Get status for OpenStack instance...        MachineId=61c5d8f4-8e78-480f-8540-bc7fcbef4543
(testmachine3) DBG | State for OpenStack instance        MachineId=61c5d8f4-8e78-480f-8540-bc7fcbef4543 State=ACTIVE
Machine is running, waiting for SSH to be available...
Getting to WaitForSSH function...
(testmachine3) Calling RpcServerDriver.GetSSHHostname
(testmachine3) Calling RpcServerDriver.GetSSHPort
(testmachine3) Calling RpcServerDriver.GetSSHKeyPath
(testmachine3) Calling RpcServerDriver.GetSSHUsername
Using SSH client type: external
About to run SSH command:
exit 0
SSH cmd err, output: exit status 255: 
Error getting ssh command 'exit 0' : Something went wrong running an SSH command!
command : exit 0
err     : exit status 255
output  : 

Getting to WaitForSSH function...
(testmachine3) Calling RpcServerDriver.GetSSHHostname
(testmachine3) Calling RpcServerDriver.GetSSHPort
(testmachine3) Calling RpcServerDriver.GetSSHKeyPath
(testmachine3) Calling RpcServerDriver.GetSSHUsername
Using SSH client type: external
About to run SSH command:
exit 0"

Please help me,how to use the docker-machine with openstack create the vm and the vm can install docker auto automatic.

nathanleclaire commented 8 years ago

What's the output if you CTRL+C and run docker-machine --debug ssh testmachine3? Exit status 255 indicates that SSH was not able to make a proper handshake. Also, try docker-machine --native-ssh --debug create as well to see if that fares any better.

yutinghgx commented 8 years ago

Hello,when I try "docker-machine --native-ssh --debug create" it output

"Docker Machine Version: 0.5.0 (04cfa58)
Found binary path at /usr/local/bin/docker-machine-driver-openstack
Launching plugin server for driver openstack
Plugin server listening at address 127.0.0.1:54650
() 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 /usr/local/bin/docker-machine-driver-openstack
Launching plugin server for driver openstack
Plugin server listening at address 127.0.0.1:34426
() Calling RpcServerDriver.GetVersion
Using API Version 1
() Calling RpcServerDriver.SetConfigRaw
() Calling RpcServerDriver.GetMachineName
(testmachine4) Calling RpcServerDriver.GetMachineName
(testmachine4) Calling RpcServerDriver.DriverName
(testmachine4) Calling RpcServerDriver.GetCreateFlags
(testmachine4) Calling RpcServerDriver.SetConfigFromFlags
Running pre-create checks...
(testmachine4) Calling RpcServerDriver.PreCreateCheck
(testmachine4) Calling RpcServerDriver.GetConfigRaw
(testmachine4) Calling RpcServerDriver.GetConfigRaw
Creating machine...
(testmachine4) Calling RpcServerDriver.Create
(testmachine4) DBG | Authenticating...       AuthUrl=http://10.100.11.4:5000/v2.0 DomainID= DomainName= Insecure=false TenantID= TenantName=admin Username=admin
(testmachine4) DBG | Found network id using its name         ID=6239f7aa-258f-4a66-a16e-558310fb313a Name=vlan16
(testmachine4) DBG | Creating Key Pair...        Name=testmachine4-b5cc2f1d89b3d612901a3e7577e018312817eba5e62c65ac3a904e98f3d59c65
(testmachine4) OUT | Creating machine...
(testmachine4) DBG | Creating OpenStack instance...      FlavorId=682ba378-b3db-4fb6-8b1f-a1c8189e913f ImageId=5b293dd4-0a38-4cd7-851f-1106ddde619c
(testmachine4) DBG | Waiting for the OpenStack instance to be ACTIVE...      MachineId=378656fe-1ee6-47c0-a1b4-25b843a2b284
(testmachine4) DBG | Looking for the IP address...       MachineId=378656fe-1ee6-47c0-a1b4-25b843a2b284
(testmachine4) DBG | IP address found        IP=10.100.16.53 MachineId=378656fe-1ee6-47c0-a1b4-25b843a2b284
(testmachine4) Calling RpcServerDriver.GetConfigRaw
(testmachine4) Calling RpcServerDriver.GetConfigRaw
(testmachine4) Calling RpcServerDriver.DriverName
Waiting for machine to be running, this may take a few minutes...
(testmachine4) Calling RpcServerDriver.GetState
(testmachine4) DBG | Get status for OpenStack instance...        MachineId=378656fe-1ee6-47c0-a1b4-25b843a2b284
(testmachine4) DBG | State for OpenStack instance        MachineId=378656fe-1ee6-47c0-a1b4-25b843a2b284 State=ACTIVE
Machine is running, waiting for SSH to be available...
Getting to WaitForSSH function...
(testmachine4) Calling RpcServerDriver.GetSSHHostname
(testmachine4) Calling RpcServerDriver.GetSSHPort
(testmachine4) Calling RpcServerDriver.GetSSHKeyPath
(testmachine4) Calling RpcServerDriver.GetSSHUsername
Using SSH client type: native
About to run SSH command:
exit 0
Error dialing TCP: dial tcp 10.100.16.53:22: getsockopt: no route to host
Error dialing TCP: dial tcp 10.100.16.53:22: getsockopt: no route to host
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [publickey none], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [publickey none], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [publickey none], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [publickey none], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Error dialing TCP: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain"

Please help me how to do it ,thanks very much !!!

nathanleclaire commented 8 years ago

Do you have dangling created instances are running create? Looks like 10.100.16.53 is just not a reachable route from your host. Can you ping that IP? If not, try and troubleshoot why you might not be able to reach that route. Any proxy? VPN?

yutinghgx commented 8 years ago

Yes,I can ping that IP 10.100.16.53.It looks normal.

yutinghgx commented 8 years ago

I have not solutite this problem,who can help me!!! Thanks!!!!

allamand commented 8 years ago

@yutinghgx i have similar problem provisionning a machine from a existing VM snapshot, it seams that in that case docker-machine is not able to install it's own ssh key to authenticate. I'am able to authenticate on the new provisionned machine with the old key which was present during the snapshot.

anyone have an idea how docker-machine install it's own key at the first time ?

fsoppelsa commented 8 years ago

yutinghgx, is your security group you're docker-machine creating onto, allowing incoming SSH and tcp/2376 ?

yutinghgx commented 8 years ago

@fsoppelsa yes the security group is allwoing incoming any tcp port.

fsoppelsa commented 8 years ago

Looks like a routing and/or firewall issue.

Can you SSH to the instances that machine created without any problem? Something like:

ssh -o PasswordAuthentication=no -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -i /path/to/.docker/machine/machines/machine1/id_rsa -p 22 user@172.18.186.56

allamand commented 8 years ago

I still encounter this issue which is very anoying with the time.

Now I can make a direct ssh to the machine, but with docker machine I got an error which I don't understand why


direct ssh: [cloud@rancher ~]$ ssh cloud@192.168.1.8 Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-74-generic x86_64)

is working fine


but with docker-machine

[cloud@rancher ~]$ docker-machine ssh frontend01 Expected HTTP response code [200 203] when accessing [GET https://compute.fr1.cloudwatt.com/v2/b742b9ebd5d74f80918987a86318f5de/servers/], but got 404 instead 404 Not Found

The resource could not be found.


with debug

[cloud@rancher ~]$ docker-machine --debug --native-ssh ssh frontend01 Docker Machine Version: 0.5.6, build 61388e9 Found binary path at /usr/local/bin/docker-machine Launching plugin server for driver openstack Plugin server listening at address 127.0.0.1:34633 () Calling .GetVersion Using API Version 1 () Calling .SetConfigRaw () Calling .GetMachineName (frontend01) Calling .GetState (frontend01) DBG | Get status for OpenStack instance... mapMachineId: DBG | Authenticating... map[DomainName: Username:uname@domain.com TenantName:COMPUTE-xxxxxxxxxx TenantID:xxxxxxxx AuthUrl:https://identity.fr1.cloudwatt.com/v2.0 Insecure:false DomainID:] Expected HTTP response code [200 203] when accessing [GET https://compute.fr1.cloudwatt.com/v2/b742b9ebd5d74f80918987a86318f5de/servers/], but got 404 instead 404 Not Found

The resource could not be found.

What is this request which get a 404 error ?

I see that the number of file in .docker is different between host working and host not working :+1: [cloud@rancher ~]$ ll .docker/machine/machines/frontend01 total 20 drwx------ 2 cloud cloud 4096 Jan 20 16:35 ./ drwx------ 18 cloud cloud 4096 Jan 20 17:22 ../ -rw------- 1 cloud cloud 3152 Jan 20 16:35 config.json -rw------- 1 cloud cloud 1679 Jan 20 16:35 id_rsa -rw------- 1 cloud cloud 390 Jan 20 16:35 id_rsa.pub [cloud@rancher ~]$ ll .docker/machine/machines/frontend04 total 40 drwx------ 2 cloud cloud 4096 Jan 20 17:02 ./ drwx------ 18 cloud cloud 4096 Jan 20 17:22 ../ -rw-rw-r-- 1 cloud cloud 1025 Jan 20 17:02 ca.pem -rw-rw-r-- 1 cloud cloud 1050 Jan 20 17:02 cert.pem -rw------- 1 cloud cloud 3328 Jan 20 17:02 config.json -rw------- 1 cloud cloud 1679 Jan 20 16:48 id_rsa -rw------- 1 cloud cloud 390 Jan 20 16:48 id_rsa.pub -rw------- 1 cloud cloud 1675 Jan 20 17:02 key.pem -rw------- 1 cloud cloud 1679 Jan 20 17:02 server-key.pem -rw-rw-r-- 1 cloud cloud 1123 Jan 20 17:02 server.pem

but I still ssh directly into frontend01 so why docker-machine can't ? docker-machine regenerate-certs finish also in error always the same

[cloud@rancher ~]$ docker-machine --debug regenerate-certs frontend01 Docker Machine Version: 0.5.6, build 61388e9 Regenerate TLS machine certs? Warning: this is irreversible. (y/n): y Regenerating TLS certificates Found binary path at /usr/local/bin/docker-machine Launching plugin server for driver openstack Plugin server listening at address 127.0.0.1:49045 () Calling .GetVersion Using API Version 1 () Calling .SetConfigRaw () Calling .GetMachineName command=configureAuth machine=frontend01 Detecting the provisioner... (frontend01) Calling .GetSSHHostname (frontend01) DBG | Looking for the IP address... mapMachineId: DBG | Authenticating... map[Username:TenantName:f TenantID: AuthUrl:https://identity.fr1.cloudwatt.com/v2.0 Insecure:false DomainID: DomainName:] Error getting SSH command: Expected HTTP response code [200 203] when accessing [GET https://compute.fr1.cloudwatt.com/v2/b742b9ebd5d74f80918987a86318f5de/servers/], but got 404 instead 404 Not Found

thanks

fsoppelsa commented 8 years ago

Requests that gets 404 is the Nova endpoint, seems. Probably you may want to destroy frontend1 machine, and recreate it.

allamand commented 8 years ago

@fabrizio,

In fact i found a way to "repair" from a docker-machine point of view just be retrieving the MachineID from a nova command and manually add-it in the docker-machine config.json file.

So the machine was ok on openstack side (but it may have take too long for docker-machine to retrieve correctly the machineid which remains empty in the config file.

I think docker-machine may have a way to fix this on his own ?

Sébastien

Le 26 janv. 2016 à 10:35, Fabrizio Soppelsa notifications@github.com a écrit :

Requests that gets 404 is the Nova endpoint, seems. Probably you may want to destroy frontend1 machine, and recreate it.

— Reply to this email directly or view it on GitHub.

fsoppelsa commented 8 years ago

Thanks for feedback @sebmoule, probably we may want to add some generic dm edit. You can file some formal proposal.