我正在尝试将 Docker 插件与 Jenkins 一起使用。但是 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)
但是,当我登录到用户 jenkinssu jenkins
并执行所有操作时,curl 127.0.0.1:4243/info
一切都按预期进行。我用-H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock
.
我究竟做错了什么?