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

Cannot create Docker host on Azure from behind corporate proxy #1912

Closed mrumpf closed 8 years ago

mrumpf commented 9 years ago

I try to create a Docker host on Microsoft Azure from behind a corporate proxy in a Cygwin environment under Windows 7. The following command fails:

$ docker-machine -D create -d azure --engine-env HTTP_PROXY=${http_proxy} --engine-env HTTPS_PROXY=${https_proxy} --azure-subscription-id="b3e891af-9553-43c9-aa9d-66ef5b2e6294" --azure-subscription-cert="mycert.pem" azuretest
+ docker-machine -D create -d azure --engine-env HTTP_PROXY=http://10.206.246.20:8080 --engine-env HTTPS_PROXY=http://10.206.246.20:8080 --azure-subscription-id=b3e891af-9553-43c9-aa9d-66ef5b2e6294 --azure-subscription-cert=mycert.pem azuretest
Error creating machine: Get https://management.core.windows.net/b3e891af-9553-43c9-aa9d-66ef5b2e6294/services/hostedservices/operations/isavailable/azuretest: dial tcp 23.102.135.246:443: ConnectEx tcp: No connection could be made because the target machine actively refused it.
You will want to check the provider to make sure the machine and associated resources were properly removed.

When I try to access the same URL with curl (proxy is configured via http_proxy and https_proxy as environment variables), the connect seems to be possible because curl sends back an error message from the server:

$ curl https://management.core.windows.net/b3e891af-9553-43c9-aa9d-66ef5b2e6294/services/hostedservices/operations/isavailable/azuretest
+ curl https://management.core.windows.net/b3e891af-9553-43c9-aa9d-66ef5b2e6294/services/hostedservices/operations/isavailable/azuretest
<Error xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Code>ForbiddenError</Code><Message>The server failed to authenticate the request. Verify that the certificate is valid and is associated with this subscription.</Message></Error>

BTW, adding the -D debug switch does not reveal any additional information about what is going on behind the scenes. To me it seems as if the -D switch does not work at all.

dgageot commented 8 years ago

Hi @mrumpf which version of machine are you using?

mrumpf commented 8 years ago
C:\>docker-machine -v
docker-machine version 0.4.1 (e2c88d6)
dgageot commented 8 years ago

@mrumpf Thanks. Can you try latest release candidate 0.5.0-rc4, tell us if it still fails and gist the whole output? That would be perfect.

mrumpf commented 8 years ago

Great! Debug output has been improved.

Unfortunately the error is the same:

C:\> docker-machine -D create -d azure --engine-env HTTP_PROXY=%http_proxy% --engine-env HTTPS_PROXY=%https_proxy% --azure-subscription-id="b3e891af-9553-43c9-aa9d-66ef5b2e6294" --azure-subscription-cert="mycert.pem" azuretest
Docker Machine Version: 0.5.0-rc4 (952539d)
Launching plugin server for driver azure
Found binary path at C:\Users\mrumpf\bin\docker-machine-driver-azure.exe
Plugin server listening at address 127.0.0.1:19183
() Calling RpcServerDriver.GetVersion
Using API Version 1
() Calling RpcServerDriver.SetConfigRaw
() Calling RpcServerDriver.GetMachineName
(--azure-subscription-cert=mycert.pem) Calling RpcServerDriver.GetCreateFlags
Making call to close connection to plugin binary
Making call to close driver server
(--azure-subscription-cert=mycert.pem) Calling RpcServerDriver.Close
Successfully made call to close driver server
Launching plugin server for driver azure
Found binary path at C:\Users\mrumpf\bin\docker-machine-driver-azure.exe
Plugin server listening at address 127.0.0.1:19187
() Calling RpcServerDriver.GetVersion
Using API Version 1
() Calling RpcServerDriver.SetConfigRaw
() Calling RpcServerDriver.GetMachineName
(azuretest) Calling RpcServerDriver.GetMachineName
(azuretest) Calling RpcServerDriver.DriverName
(azuretest) Calling RpcServerDriver.GetCreateFlags
(azuretest) Calling RpcServerDriver.SetConfigFromFlags
Running pre-create checks...
(azuretest) Calling RpcServerDriver.PreCreateCheck
Error creating machine: Error with pre-create check: Get https://management.core.windows.net/b3e891af-9553-43c9-aa9d-66ef5b2e6294/services/hostedservices/operations/isavailable/azuretest: dial tcp 23.102.135.246:443: connectex: No connection could be made because the target machine actively refused it.

C:\> echo %http_proxy%
http://10.206.246.20:8080

The issue looks proxy related, but I have specified a proxy on the command line and the last 2 lines of the dump above shows that it is set.

ahmetb commented 8 years ago

@mrumpf Hello, can you please run the following command from your proxy and send its output:

curl -iv https://management.azure.com/subscriptions/b3e891af-9553-43c9-aa9d-66ef5b2e6294/resourcegroups?api-version\=2014-04-01-preview

I see you're using windows, so if you use git bash, you can run curl from there.

ahmetb commented 8 years ago

@mrumpf ping, can you please just ping this domain to see if you're still having the issue?

ahmetb commented 8 years ago

@nathanleclaire please close.