gradle-docker-plugin: Cannot build image in local docker machine
I use gradle-docker-plugin, my configuration is the following:
`id ‘com.bmuschko.docker-remote-api’ version ‘3.0.1’ id ‘com.bmuschko.docker-java-application’ version ‘3.0.1’
docker { url = ‘http://192.168.99.100:2376’ javaApplication { baseImage = ‘dockerfile/java:openjdk-8-jre’ maintainer = ‘Anuar Nurmakanov “Anuar_Nurmakanov@epam.com”’ port = 9090 tag = ‘mama_home:1.0’ } }` Where http://192.168.99.100:2376 is url of my Docker instance.
When I try to run dockerBuildImage, I get the following error: `[dockerjava-jaxrs-async-0] INFO org.apache.http.impl.execchain.RetryExec - I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error [dockerjava-jaxrs-async-0] ERROR com.github.dockerjava.core.async.ResultCallbackTemplate - Error during callback org.apache.http.client.ClientProtocolException at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:188) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72) at com.github.dockerjava.jaxrs.connector.ApacheConnector.apply(ApacheConnector.java:437) at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:246) at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:683) 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:679) at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:435) at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:338) 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) Caused by: org.apache.http.client.NonRepeatableRequestException: Cannot retry request with a non-repeatable request entity at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:102) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186) … 18 more Caused by: java.net.SocketException: Connection reset by peer: socket write error at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109) at java.net.SocketOutputStream.write(SocketOutputStream.java:153) at org.apache.http.impl.io.SessionOutputBufferImpl.streamWrite(SessionOutputBufferImpl.java:123) at org.apache.http.impl.io.SessionOutputBufferImpl.flushBuffer(SessionOutputBufferImpl.java:135) at org.apache.http.impl.io.SessionOutputBufferImpl.write(SessionOutputBufferImpl.java:164) at org.apache.http.impl.io.ChunkedOutputStream.flushCacheWithAppend(ChunkedOutputStream.java:124) at org.apache.http.impl.io.ChunkedOutputStream.write(ChunkedOutputStream.java:181) at org.glassfish.jersey.message.internal.CommittingOutputStream.write(CommittingOutputStream.java:229) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$UnCloseableOutputStream.write(WriterInterceptorExecutor.java:299) at org.glassfish.jersey.message.internal.ReaderWriter.writeTo(ReaderWriter.java:114) at org.glassfish.jersey.message.internal.AbstractMessageReaderWriterProvider.writeTo(AbstractMessageReaderWriterProvider.java:77) at org.glassfish.jersey.message.internal.InputStreamProvider.writeTo(InputStreamProvider.java:105) at org.glassfish.jersey.message.internal.InputStreamProvider.writeTo(InputStreamProvider.java:60) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) at com.github.dockerjava.jaxrs.filter.LoggingFilter.aroundWriteTo(LoggingFilter.java:300) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1154) at org.glassfish.jersey.client.ClientRequest.writeEntity(ClientRequest.java:503) at com.github.dockerjava.jaxrs.connector.ApacheConnector$2.writeTo(ApacheConnector.java:572) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.apache.http.impl.execchain.RequestEntityExecHandler.invoke(RequestEntityExecHandler.java:77) at com.sun.proxy.$Proxy69.writeTo(Unknown Source) at org.apache.http.impl.DefaultBHttpClientConnection.sendRequestEntity(DefaultBHttpClientConnection.java:155) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.apache.http.impl.conn.CPoolProxy.invoke(CPoolProxy.java:138) at com.sun.proxy.$Proxy70.sendRequestEntity(Unknown Source) at org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:236) at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:253) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:194) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:85) … 20 more :dockerBuildImage FAILED
FAILURE: Build failed with an exception.
-
What went wrong: Execution failed for task ‘:dockerBuildImage’.
java.lang.reflect.InvocationTargetException–>null
-
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 7.664 secs Connection reset by peer: socket write error 13:20:07: External task execution finished ‘dockerBuildImage’. ` My docker instance is running on Windows 10
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 20
I assume you’re using
Docker ToolBox, so make sure your build script hasdockerclosure like :Adjust your
build.gradlelike thisand then invoke
GradleatJenkinspassing project parameters withDocker EngineURL and certificatesSo, automagically on Jenkins it will use Docker Engine location from Gradle project propeties and locally it will rely on env variables.
–debug from gradle wasn’t helpful, but things were clearer when I checked the log on the docker machine:
time="2018-07-04T18:19:57.791620161Z" level=error msg="Handler for POST /build returned error: invalid reference format: repository name must be lowercase"As an aside, it seems very odd that docker-java would report this as just a java.net.SocketException.
For some reason, if I have an uppercase character in project.version, this error is triggered.
edit : this is because I was manually setting the tag to the project version in my buildImage task, which bypasses the standard tag generation, which looks like it does a toLowerCase(). Because the error reporting from docker java seems so poor, is it worth validating explicit tag parameters for uppercase, and rejecting with an error?
Just deleted the v3.0.11 tag and all looks same again. It appears this was sticking out because we attempted to edit the release notes at some point thereby making a “proper” release in github eyes. IDK. In either event things should be good to go now.
@radistao @cdancy I agree it’s very confusing. I see two solutions:
ok, i’m just afraid some other people might be confused by release page in github and
latest releasebadge there. But maybe it’s just me, so forget.