Jenkins与Docker插件java.lang.NullPointerException:未指定uri

时间:2016-07-21 07:13:59

标签: jenkins docker jenkins-docker

我试图使用Jenkins的Docker插件。但是Jenkins无法访问REST API。

在Jenkins配置中,我放置了Docker REST URL:http://127.0.0.1:4243,当点击测试连接时,它会给我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)

但是当我登录用户jenkins su jenkins并执行curl 127.0.0.1:4243/info时,一切都按预期工作。我用-H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock启动了Docker。

我做错了什么?

2 个答案:

答案 0 :(得分:8)

有同样的问题,对我来说这是一个愚蠢的小事。

为新版本输入URI:http://127.0.0.1:4243或2375,然后在测试连接之前单击应用优先

答案 1 :(得分:1)

当前插件ver 1.39不接受http url格式。只有tcp://127.0.0.1:2375正常工作。