3

I'm trying to use the Docker plugin with Jenkins. But Jenkins cannot access the REST API.

In the Jenkins configuration I put the Docker REST URL: http://127.0.0.1:4243 and when clicking on test connection it gives me Something went wrong, cannot connect to http://127.0.0.1:4243, cause: null

Jul 21, 2016 8:57:52 AM WARNING org.jenkinsci.plugins.dockerbuildstep.DockerBuilder$DescriptorImpl doTestConnection

uri was not specified
java.lang.NullPointerException: uri was not specified
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:204)
at com.github.dockerjava.core.DockerClientConfig$DockerClientConfigBuilder.withUri(DockerClientConfig.java:406)
at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder$DescriptorImpl.createDockerClient(DockerBuilder.java:120)
at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder$DescriptorImpl.getDockerClient(DockerBuilder.java:204)
at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder$DescriptorImpl.doTestConnection(DockerBuilder.java:138)
at sun.reflect.GeneratedMethodAccessor235.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)

But when I login to user jenkins su jenkins and do a curl 127.0.0.1:4243/info everything works as expected. I started Docker with -H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock.

What am I doing wrong?

Syex
  • 1,320
  • 1
  • 12
  • 23
  • Same question here! http://stackoverflow.com/questions/38204371/jenkins-and-docker-uri-was-not-specified . But unanswered. Try bounty – atv Jul 21 '16 at 09:00

2 Answers2

8

Had the same issue, for me it was a stupid little thing.

Enter the URI: http://127.0.0.1:4243 or 2375 for the new version and click Apply first before you Test the connection.

Meiko Watu
  • 451
  • 1
  • 4
  • 11
  • Can't believe I spent 2 hours of my life and hitting Apply was the solution! BTW this should be an answer. – Vish Aug 04 '16 at 10:46
1

Current plugin ver 1.39 doesn't accept http url format. Only tcp://127.0.0.1:2375 works fine.