简体   繁体   中英

Docker-machine and Openstack / SSH

I have a problem with docker-machine and openstack

running this command docker-machine --debug create -d openstack --openstack-username admin --openstack-password admin --openstack-tenant-name admin --openstack-auth-url http://163.172.5.197:5000/v2.0 --openstack-flavor-id bea5cb42-c0b3-46fd-96a6-2f4c5d4448c2 --openstack-image-id 871a5ddf-a888-4b45-9201-78da07e6cdcb testmachine

gives me the output as follow

Docker Machine Version:  0.6.0, build e27fb87
Found binary path  at /usr/local/bin/docker-machine
Launching plugin server for driver openstack
Plugin server listening at address 127.0.0.1:46658
() 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
Launching plugin server for driver openstack
Plugin server listening at address 127.0.0.1:44014
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(testmachine) Calling .GetMachineName
(testmachine) Calling .DriverName
(testmachine) Calling .GetCreateFlags
(testmachine) Calling .SetConfigFromFlags
Running pre-create checks...
(testmachine) Calling .PreCreateCheck
(testmachine) Calling .GetConfigRaw
Creating machine...
(testmachine) Calling .Create
(testmachine) DBG | Authenticating... map[Insecure:false DomainID: DomainName: Username:admin TenantName:admin TenantID: AuthUrl:http://163.172.5.197:5000/v2.0]
(testmachine) DBG | Found tenant id using its name map[Name:admin ID:3247c97c6abf4c07aee78043a1caa261]
(testmachine) DBG | Creating Key Pair... map[Name:testmachine-5f792f35e57c8749b3a39074cc230831a6902250f91c7f76fb30299ad00713be]
(testmachine) Creating machine...
(testmachine) DBG | Creating OpenStack instance... map[FlavorId:bea5cb42-c0b3-46fd-96a6-2f4c5d4448c2 ImageId:871a5ddf-a888-4b45-9201-78da07e6cdcb]
(testmachine) DBG | Waiting for the OpenStack instance to be ACTIVE... map[MachineId:3184e817-07d2-47af-9cb7-06634cebcc0a]
(testmachine) DBG | Looking for the IP address... map[MachineId:3184e817-07d2-47af-9cb7-06634cebcc0a]
(testmachine) Calling .GetConfigRaw
(testmachine) Calling .DriverName
(testmachine) Calling .DriverName
Waiting for machine to be running, this may take a few minutes...
(testmachine) Calling .GetState
(testmachine) DBG | IP address found map[IP:10.0.0.2 MachineId:3184e817-07d2-47af-9cb7-06634cebcc0a]
(testmachine) DBG | Get status for OpenStack instance... map[MachineId:3184e817-07d2-47af-9cb7-06634cebcc0a]
(testmachine) DBG | State for OpenStack instance map[MachineId:3184e817-07d2-47af-9cb7-06634cebcc0a State:ACTIVE]
Detecting operating system of created instance...
Waiting for SSH to be available...
Getting to WaitForSSH function...
(testmachine) Calling .GetSSHHostname
(testmachine) Calling .GetSSHPort
(testmachine) Calling .GetSSHKeyPath
(testmachine) Calling .GetSSHKeyPath
(testmachine) Calling .GetSSHUsername
Using SSH client type: external
{[-o BatchMode=yes -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@10.0.0.2 -o IdentitiesOnly=yes -i /home/martin/.docker/machine/machines/testmachine/id_rsa -p 22] /usr/bin/ssh}
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...
(testmachine) Calling .GetSSHHostname
(testmachine) Calling .GetSSHPort
(testmachine) Calling .GetSSHKeyPath
(testmachine) Calling .GetSSHKeyPath
(testmachine) Calling .GetSSHUsername
Using SSH client type: external
{[-o BatchMode=yes -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@10.0.0.2 -o IdentitiesOnly=yes -i /home/martin/.docker/machine/machines/testmachine/id_rsa -p 22] /usr/bin/ssh}
About to run SSH command:
exit 0

then when i am trying to run docker-machine ls

testmachine - openstack Running tcp://10.0.0.2:2376 Unknown Unable to query docker version: Unable to read TLS config: open /home/martin/.docker/machine/machines/testmachine/server.pem: no such file or directory

Logs in openstack for machine :

open-vm-tools: not starting as this is not a VMware VM
landscape-client is not configured, please run landscape-config.
* Stopping CPU interrupts balancing daemon[74G[ OK ]
* Starting automatic crash report generation[74G[ OK ]
* Restoring resolver state...       [80G [74G[ OK ]
* Stopping System V runlevel compatibility[74G[ OK ]
Generating locales...
en_US.UTF-8... up-to-date
Generation complete.
Cloud-init v. 0.7.5 running 'modules:final' at Tue, 03 May 2016 11:45:45 +0000. Up 10.17 seconds.
ci-info: +++++Authorized keys from /home/ubuntu/.ssh/authorized_keys for user ubuntu++++++
ci-info: +---------+-------------------------------------------------+---------+---------+
ci-info: | Keytype |                Fingerprint (md5)                | Options | Comment |
ci-info: +---------+-------------------------------------------------+---------+---------+
ci-info: | ssh-rsa | fe:05:1e:f2:04:c4:df:4f:53:f2:4f:c3:ba:ac:10:51 |    -    |    -    |
ci-info: +---------+-------------------------------------------------+---------+---------+
ec2: 
ec2: #############################################################
ec2: -----BEGIN SSH HOST KEY FINGERPRINTS-----
ec2: 1024 46:c0:bb:6c:65:04:13:fc:ab:2b:51:4f:1c:1e:75:dc  root@testmachine (DSA)
ec2: 256 81:cd:f3:dd:66:7a:ca:4e:95:78:43:a7:dc:29:ad:fd  root@testmachine (ECDSA)
ec2: 256 f5:d9:c7:59:92:af:fc:b7:56:42:ca:1e:f7:bb:5b:89  root@testmachine (ED25519)
ec2: 2048 6e:2d:1b:52:84:3f:28:04:95:41:81:15:af:61:e5:96  root@testmachine (RSA)
ec2: -----END SSH HOST KEY FINGERPRINTS-----
ec2: #############################################################
-----BEGIN SSH HOST KEY KEYS-----
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFfEl02HEegH7vohFTTS1bxA7LaIua/f+j0Uvi1u3j8fyTfzuVzqHl73QaBtE6uJ7EuTaoDhNCeeyWF+sLqMulI= root@testmachine
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGmcm55oSkblJ//oUcNQMqB2oO7BG2vXA0fhHEhlOQba root@testmachine
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDc3VqU3V9of956GD0DhCc5YEbkBzOgOazVRiFxx31I2wW3Z5vnW+BgZLoRhB8Zj2Tbn70l7cPKcN3/orklZldhoSK4u0+0buqhArqqp+/JBmR5AXn6hlcRvpLU+KM1qFovJuwwuttelaB0vS9YzwCLiCODLp9A4mvOCFiCbxOpvz7Bt5mMlvBnZnN3iWNiAn4aMjCrxwuUGruTXnO9ffRMs6GC4WVazUD42cD34g4FUlPf1Dqlinau5bRQrNbrU8vhiXE+DhxQO4WMMulsYoKfVDxhRrokwNpS9rB1HhHd+VOh7iTwkEwszCPtsYSrXYVng8JZzHBdq94SrOU3D58Z root@testmachine
-----END SSH HOST KEY KEYS-----
Cloud-init v. 0.7.5 finished at Tue, 03 May 2016 11:45:46 +0000. Datasource DataSourceConfigDriveNet [net,ver=2][source=/dev/sr0].  Up 10.27 seconds

Ubuntu 14.04.4 LTS testmachine ttyS0

testmachine login: 

I precise that ports 22, 80 and 2376 are open on the machine on OpenStack.

thanks, if someone could help me, it would be nice

TL;DR Try adding the following options:

  • --openstack-net-id or --openstack-net-name
  • --openstack-floatingip-pool
  • --openstack-sec-groups

Original answer :

I get the very same thing when running docker-machine 0.6.0 with the openstack driver. But v0.7.0 (build a650a40) works just fine for me. I'm running a centos image not ubuntu, but otherwise the same. Sorry, I've not used docker-machine in a while but try just grabbing the latest release and see if that helps.

Update :

Just double-checked what I ran above, I actually configured this with environment variables, specifying a few things additional to yours above. Specifically though, in addition to my openstack RC file , I set:

export OS_SSH_USER=centos
export OS_IMAGE_ID=c31637b9-455a-4849-8f46-2af1715f9dee
export OS_FLAVOR_NAME=m1.small
export OS_FLOATINGIP_POOL=INTERNAL-NETWORK
export OS_SECURITY_GROUPS=default
export OS_NETWORK_ID=b32e2700-8eac-4b7c-b9a8-16b6403927a2

and then ran:

docker-machine create -d=openstack testmachine

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM