Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

https protocol is not supported #20

Closed
francisdb opened this issue Dec 15, 2015 · 18 comments
Closed

https protocol is not supported #20

francisdb opened this issue Dec 15, 2015 · 18 comments

Comments

@francisdb
Copy link

If you forget to set up the DOCKER_HOST you get this error. This should probably fail with a more appropriate error.

And it should probably default to unix:///var/run/docker.sock

javax.ws.rs.ProcessingException: org.apache.http.conn.UnsupportedSchemeException: https protocol is not supported
    at com.github.dockerjava.jaxrs.connector.ApacheConnector.apply(ApacheConnector.java:490)
    at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:246)
    at org.glassfish.jersey.client.JerseyInvocation$3.call(JerseyInvocation.java:705)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:424)
    at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:701)
    at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:417)
    at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:313)
    at com.github.dockerjava.jaxrs.ListImagesCmdExec.execute(ListImagesCmdExec.java:35)
    at com.github.dockerjava.jaxrs.ListImagesCmdExec.execute(ListImagesCmdExec.java:17)
    at com.github.dockerjava.jaxrs.AbstrDockerCmdExec.exec(AbstrDockerCmdExec.java:53)
    at com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:29)
    at com.whisk.docker.DockerKit$$anonfun$listImages$1.apply(DockerKit.scala:25)
    at com.whisk.docker.DockerKit$$anonfun$listImages$1.apply(DockerKit.scala:25)
Caused by: org.apache.http.conn.UnsupportedSchemeException: https protocol is not supported
    at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:99)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:314)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:357)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:218)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:194)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:85)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
    at com.github.dockerjava.jaxrs.connector.ApacheConnector.apply(ApacheConnector.java:443)
    ... 15 more
@francisdb
Copy link
Author

Upgrading to the latest docker-java might already yield better results

@viktortnk
Copy link
Contributor

@francisdb I've just upgraded to 2.1.4. Unfortunately it doesn't provide any better error message. I think it is up to docker-java to report about lack of DOCKER_HOST or DOCKER_URL.

@francisdb
Copy link
Author

@viktortnk Have you found an upstream ticket on this? Otherwise I will create one.

@viktortnk
Copy link
Contributor

@francisdb No, sorry. Didn't check any

@francisdb
Copy link
Author

I reported it upstream: docker-java/docker-java#419

@francisdb
Copy link
Author

Seems that without a PR this will not be solved in the near future

@TimSoethout
Copy link

Any workarounds for now? I'm running into this error but I did specify DOCKER_HOST. It also seems to pick this up (with http://), but somehow still I get this error.

@TimSoethout
Copy link

This seems to do something

override implicit val docker : Docker =
    new Docker(DockerClientConfig.createDefaultConfigBuilder()
      .withUri("http://192.168.59.103:2375")
      .withSSLConfig(null)
      .build())

If I do println("CONTAINERS: " + docker.client.listContainersCmd().exec()) it work.
But my C* docker is not started (nor any request for it received by the docker host)

@akauppi
Copy link
Contributor

akauppi commented Feb 5, 2016

I get repeatedly bitten by this. I understand the project's point that docker-java should fix it, but at the same time it's not difficult to do it here (would take one .sbt file that can be removed when upstream checking is there). Would you use such if I craft one?

@viktortnk
Copy link
Contributor

Sorry @akauppi I'm not sure I'm entirely understand what you are proposing

@francisdb
Copy link
Author

@viktortnk could try docker-java-3.0.0-RC1 as docker-java/docker-java#419 has been fixed

@viktortnk
Copy link
Contributor

There is already build against this version on maven central. 0.7.0-RC1

@francisdb
Copy link
Author

Ok, with this build I get the following when docker is not running:

com.github.dockerjava.api.exception.DockerClientException: Certificate path (DOCKER_CERT_PATH) '/Users/me/.docker/certs' doesn't exist. (DockerClientConfig.java:112)

which at least points to docker so I guess we can consider this ticket closed 👍

(everything works by default with the docker quickstart terminal om OSX)

@francisdb
Copy link
Author

Hmm, now our jenkins build on Ubuntu fails when setting
export DOCKER_HOST=unix:///var/run/docker.sock

see docker-java/docker-java#480

@francisdb
Copy link
Author

Next issue, this time on the docker-it-scala side

with DOCKER_TLS_VERIFY=0 and export DOCKER_HOST=unix:///var/run/docker.sock I now have this

ERROR com.whisk.docker.DockerContainer - java.lang.IllegalArgumentException: protocol = http host = null
java.lang.RuntimeException: java.lang.IllegalArgumentException: protocol = http host = null
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1453) ~[na:1.8.0_25]
    at sun.net.www.protocol.http.HttpURLConnection.access$200(HttpURLConnection.java:90) ~[na:1.8.0_25]
    at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1431) ~[na:1.8.0_25]
    at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1429) ~[na:1.8.0_25]
    at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_25]
    at java.security.AccessController.doPrivileged(AccessController.java:713) ~[na:1.8.0_25]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1428) ~[na:1.8.0_25]
    at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:2965) ~[na:1.8.0_25]
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:489) ~[na:1.8.0_25]
    at com.whisk.docker.DockerReadyChecker$HttpResponseCode$$anonfun$apply$9$$anonfun$apply$1.apply$mcZ$sp(DockerReadyChecker.scala:85) ~[docker-testkit-core_2.11-0.7.0-RC1.jar:0.7.0-RC1]
    at com.whisk.docker.DockerReadyChecker$HttpResponseCode$$anonfun$apply$9$$anonfun$apply$1.apply(DockerReadyChecker.scala:82) ~[docker-testkit-core_2.11-0.7.0-RC1.jar:0.7.0-RC1]
    at com.whisk.docker.DockerReadyChecker$HttpResponseCode$$anonfun$apply$9$$anonfun$apply$1.apply(DockerReadyChecker.scala:82) ~[docker-testkit-core_2.11-0.7.0-RC1.jar:0.7.0-RC1]

@francisdb francisdb reopened this Feb 26, 2016
@francisdb
Copy link
Author

Want me to create a new issue?

@francisdb
Copy link
Author

seems to be related to docker-java/docker-java#537 and somehow #33

@francisdb
Copy link
Author

francisdb commented Aug 8, 2016

Meanwhile using 0.9.0-M5 this returns a different error (Could not find library in classpath, tried: [libjunixsocket-macosx-1.8-x86_64.dylib, libjunixsocket-macosx-1.5-x86_64.dylib]) and a workaround is to add this to your tests:

override implicit val dockerFactory: DockerFactory = new SpotifyDockerFactory(DefaultDockerClient.fromEnv().build())

see https://github.com/whisklabs/docker-it-scala#docker-for-mac-setup

Better to check the upstream issue for fixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants