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

Problem using Azure driver #492

Closed roldancer closed 9 years ago

roldancer commented 9 years ago

Hi I'm running the following command but I get an error:

$ ./docker-machine_linux-amd64 -D create -d azure --azure-subscription-id=[SUB_ID] --azure-subscription-cert=azure_cert.pem docker

ERRO[0013] Error creating machine: Get https://management.core.windows.net/[SUB_ID]/services/hostedservices/operations/isavailable/docker: local error: internal error WARN[0013] You will want to check the provider to make sure the machine and associated resources were properly removed. FATA[0013] Error creating machine

Any idea, what I'm doing wrong ?

ehazlett commented 9 years ago

@jeffmendoza any idea?

jeffmendoza commented 9 years ago

Not sure what the issue is, should be a simple request. Try curl:

curl -E azure_cert.pem -H "x-ms-version: 2014-10-01" https://management.core.windows.net/[subscription_id]/services/hostedservices/operations/isavailable/docker123

roldancer commented 9 years ago

curl -E azure_cert.pem --key azure_key.pem -H "x-ms-version: 2014-10-01" https://management.core.windows.net/[subscription_id]/services/hostedservices/operations/isavailable/docker123

<AvailabilityResponse xmlns="http://schemas.microsoft.com/windowsazure" 
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Result>true</Result><Reason i:nil="true"/>
</AvailabilityResponse>
roldancer commented 9 years ago

Hi, if you look at the curl prameters, I 'm using a file por the SSL cert and another for the private key, probably that's the problem with the docker machine azure driver, what do you think ?

jeffmendoza commented 9 years ago

The cert should contain the private key. The curl command needs to work without the --key param. What commands did you use to create your cert?

You could try two different things:

  1. Use the cli to spit out the cert: http://azure.microsoft.com/en-us/documentation/articles/xplat-cli/ The command is azure account export or something similar.
  2. Download the publishsettings, and try using that. Clicking this link should generate a new one: https://manage.windowsazure.com/publishsettings/index?client=xplat
roldancer commented 9 years ago

@jeffmendoza I run the docker-machine with the same parameters but in this case the azure_cert.pem file contains the private key, now it works ok. Thanks for your help

mrserverless commented 9 years ago

I had the same issue as @roldancer and was able to work around using azure account export

In my case, the .pem key was generated using my existing id_rsa key as per instructions here: http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-use-ssh-key/

openssl req -x509 -key ~/.ssh/id_rsa -nodes -days 365 -newkey rsa:2048 -out myCert.pem

My id_rsa key was originally created using ssh-keygen according to the github instructions.