2016-05-31 36 views
0

我正在使用: docker版本:1.11.1,build 5604cbe。我在/etc/default/docker创建的条目如下配置泊坞窗的REST API詹金斯用户组:Docker REST API没有绑定在Jenkins的端口上

​​

的PS我也试图与127.0.0.1

然后我做了sudo service docker restart

指令$ ps aux|grep docker返回:

root  12385 0.0 0.2 421840 36016 ?  Ssl 19:21 0:00 /usr/bin/docker daemon -H fd:// 
root  12391 0.0 0.0 294652 12188 ?  Ssl 19:21 0:00 docker-containerd -l /var/run/docker/libcontainerd/docker-containerd.sock --runtime docker-runc 
root  12654 0.0 0.0 21296 1028 pts/1 S+ 19:28 0:00 grep --color=auto docker 

似乎像REST API未绑定到端口:9090

然后,我使用Jenkins Docker构建步骤插件与Docker REST API进行连接,然后我使用。它返回以下:


Building in workspace /var/lib/jenkins/jobs/Telco_automated_build/workspace 
[Docker] INFO: Pulling image registry.hub.docker.com/pratyush/product:latest 
ERROR: Build step failed with exception 
javax.ws.rs.ProcessingException: org.apache.http.conn.HttpHostConnectException: Connect to 127.0.0.1:9090 [/127.0.0.1] failed: Connection refused 
    at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:513) 
    at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:246) 
    at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:667) 
    at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:664) 
    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:664) 
    at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:424) 
    at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:333) 
    at com.github.dockerjava.jaxrs.PullImageCmdExec.execute(PullImageCmdExec.java:37) 
    at com.github.dockerjava.jaxrs.PullImageCmdExec.execute(PullImageCmdExec.java:17) 
    at com.github.dockerjava.jaxrs.AbstrDockerCmdExec.exec(AbstrDockerCmdExec.java:57) 
    at com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:29) 
    at com.github.dockerjava.core.command.PullImageCmdImpl.exec(PullImageCmdImpl.java:15) 
    at org.jenkinsci.plugins.dockerbuildstep.cmd.PullImageCommand.execute(PullImageCommand.java:75) 
    at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder.perform(DockerBuilder.java:75) 
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) 

詹金斯全局设置当我打测试连接返回:

Something went wrong, cannot connect to http://127.0.0.1:9090/, cause: org.apache.http.conn.HttpHostConnectException: Connect to 127.0.0.1:9090 [/127.0.0.1] failed: Connection refused 

PS-我重新启动服务器詹金斯改变后全局设置。

任何帮助,我在哪里失踪?

+0

你可以从主机卷曲到Rest API吗? – Shibashis

+0

不是。它正在返回**未能连接。拒绝连接**。我使用的是Ubuntu 16.04 – Pratyush

回答

1

Ubuntu 16.04现在使用systemd我相信。在这种情况下,docker daemon参数未使用/etc/default/docker设置。你可以看到他们没有被输入$ ps aux|grep docker的输出中。

相反,您需要follow the instructions在基于systemd的设置中设置守护进程参数。

+0

非常感谢@jharris – Pratyush