jenkins push docker镜像时报错

jinchenfly 发布于 2017/02/22 15:09
阅读 2K+
收藏 0

使用jenkins打docker镜像,然后push镜像到docker私服。创建docker镜像这步成功了,push镜像却失败报错了。

日志:

[Docker] INFO: Creating docker image from /var/jenkins_home/workspace/jdev3/dest/war/INT/dockerfile
[Docker] INFO: BuildResponseItem[stream=Step 1 : FROM 192.168.88.144:5000/jre-tomcat
,status=<null>,progressDetail=<null>,progress=<null>,id=<null>,from=<null>,time=<null>,errorDetail=<null>,error=<null>,aux=<null>]
[Docker] INFO: BuildResponseItem[stream= ---> 5055b4a934c9
,status=<null>,progressDetail=<null>,progress=<null>,id=<null>,from=<null>,time=<null>,errorDetail=<null>,error=<null>,aux=<null>]
[Docker] INFO: BuildResponseItem[stream=Step 2 : MAINTAINER JCQ
,status=<null>,progressDetail=<null>,progress=<null>,id=<null>,from=<null>,time=<null>,errorDetail=<null>,error=<null>,aux=<null>]
[Docker] INFO: BuildResponseItem[stream= ---> Using cache
,status=<null>,progressDetail=<null>,progress=<null>,id=<null>,from=<null>,time=<null>,errorDetail=<null>,error=<null>,aux=<null>]
[Docker] INFO: BuildResponseItem[stream= ---> a4d1e9605f90
,status=<null>,progressDetail=<null>,progress=<null>,id=<null>,from=<null>,time=<null>,errorDetail=<null>,error=<null>,aux=<null>]
[Docker] INFO: BuildResponseItem[stream=Step 3 : COPY ROOT.war /opt/tomcat/webapps/
,status=<null>,progressDetail=<null>,progress=<null>,id=<null>,from=<null>,time=<null>,errorDetail=<null>,error=<null>,aux=<null>]
[Docker] INFO: BuildResponseItem[stream= ---> d32717ea2a61
,status=<null>,progressDetail=<null>,progress=<null>,id=<null>,from=<null>,time=<null>,errorDetail=<null>,error=<null>,aux=<null>]
[Docker] INFO: BuildResponseItem[stream=Step 4 : RUN rm -rf /opt/tomcat/webapps/ROOT
,status=<null>,progressDetail=<null>,progress=<null>,id=<null>,from=<null>,time=<null>,errorDetail=<null>,error=<null>,aux=<null>]
[Docker] INFO: BuildResponseItem[stream= ---> Running in f2dfb3da5a02
,status=<null>,progressDetail=<null>,progress=<null>,id=<null>,from=<null>,time=<null>,errorDetail=<null>,error=<null>,aux=<null>]
[Docker] INFO: BuildResponseItem[stream= ---> b3368b804a89
,status=<null>,progressDetail=<null>,progress=<null>,id=<null>,from=<null>,time=<null>,errorDetail=<null>,error=<null>,aux=<null>]
[Docker] INFO: BuildResponseItem[stream=Successfully built b3368b804a89
,status=<null>,progressDetail=<null>,progress=<null>,id=<null>,from=<null>,time=<null>,errorDetail=<null>,error=<null>,aux=<null>]
[Docker] INFO: Build image id:b3368b804a89
[Docker] INFO: Pushing image 192.168.88.144:5000/jdev3x:9
[Docker] ERROR: Failed to push image:192.168.88.148:4243 failed to respond
ERROR: Build step failed with exception
java.lang.RuntimeException: org.apache.http.NoHttpResponseException: 192.168.88.148:4243 failed to respond
	at com.google.common.base.Throwables.propagate(Throwables.java:156)
	at com.github.dockerjava.core.async.ResultCallbackTemplate.getFirstError(ResultCallbackTemplate.java:133)
	at com.github.dockerjava.core.async.ResultCallbackTemplate.awaitCompletion(ResultCallbackTemplate.java:94)
	at com.github.dockerjava.core.command.PushImageResultCallback.awaitSuccess(PushImageResultCallback.java:41)
	at org.jenkinsci.plugins.dockerbuildstep.cmd.PushImageCommand.execute(PushImageCommand.java:81)
	at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder.perform(DockerBuilder.java:74)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
	at hudson.model.Build$BuildExecution.build(Build.java:205)
	at hudson.model.Build$BuildExecution.doRun(Build.java:162)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
	at hudson.model.Run.execute(Run.java:1728)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:404)
Caused by: org.apache.http.NoHttpResponseException: 192.168.88.148:4243 failed to respond
	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:143)
	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
	at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261)
	at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:165)
	at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:167)
	at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:272)
	at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:124)
	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271)
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
	at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:435)
	at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:252)
	at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:701)
	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:444)
	at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:697)
	at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:448)
	at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:349)
	at com.github.dockerjava.jaxrs.async.POSTCallbackNotifier.response(POSTCallbackNotifier.java:29)
	at com.github.dockerjava.jaxrs.async.AbstractCallbackNotifier.call(AbstractCallbackNotifier.java:50)
	at com.github.dockerjava.jaxrs.async.AbstractCallbackNotifier.call(AbstractCallbackNotifier.java:24)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Build step 'Execute Docker command' marked build as failure
Finished: FAILURE

查看安装docker的机器,192.168.88.144:5000/jdev3x:9这个镜像确实有了

[root@vmware jdk1.8.0_121]# docker images
REPOSITORY                       TAG                 IMAGE ID            CREATED             SIZE
192.168.88.144:5000/jdev3x       9                   b3368b804a89        10 minutes ago      391.3 MB

试了下直接打命令是能正常push的。

docker的启动参数增加了: -H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock

jenkins中docker的配置

构建的配置:

该如何解决这问题呢?

加载中
0
youngmeng
youngmeng

你这个问题最终解决了吗

返回顶部
顶部