Maven-Docker Build cannot create docker image #357
Description
Hello, I have the following problem. When building a Docker image with dockerfile, I get the following error message. Docker plugin is used in maven. Strangely enough i can build a docker image in other spring boot applications and there i do not get such an error message. I use docker for windows. I would be pleased if I could help me.
[INFO] Building image portal-appJSF
Nov 20, 2017 6:18:37 PM org.apache.http.impl.execchain.RetryExec execute
INFORMATION: I/O exception (java.net.SocketException) caught when processing request to {}->http://localhost:2375: Connection reset by peer: socket write error
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.721 s
[INFO] Finished at: 2017-11-20T18:18:37+01:00
[INFO] Final Memory: 30M/507M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build (default-cli) on project portal-appJSF: Exception caught: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: org.apache.http.client.ClientProtocolException: Cannot retry request with a non-repeatable request entity: Connection reset by peer: socket write error -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Process finished with exit code 1
Activity
microvesalith commentedon Dec 5, 2017
I encounter the same problem. Did you find a solution?
Under windows, there's a check that has to be set, the Expose daemon on tcp://localhost:2375 without LTS. I have checked it and I was able to run once the build, successfully - and an image was built - but after another run (mvn package) I started having that error. Tried restarting everything with no success.
Output of docker version:
Client:
Version: 17.09.0-ce
API version: 1.32
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:40:09 2017
OS/Arch: windows/amd64
Server:
Version: 17.09.0-ce
API version: 1.32 (minimum version 1.12)
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:45:38 2017
OS/Arch: linux/amd64
Experimental: true
mattnworb commentedon Dec 5, 2017
The error message in the original issue indicates that the docker daemon is not listening at the address the plugin is trying to communicate with it at. See the “Setup” section of the readme for how you can customize the address to reach docker at.
microvesalith commentedon Dec 5, 2017
During the build i get this:
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.6:build (default) on project AAAa: Execution default of goal com.spotify:dockerfile-maven-plugin:1.3.6:build failed: Illegal char <:> at index 3: tcp://localhost:2375 -> [Help 1]
uelker58 commentedon Dec 6, 2017
I solved the problem by using the new plugin dockerfile-maven. Was not the deamon as previously mentioned but the plugin.
abhisheknn commentedon Oct 6, 2018
For me the issue was Capital letter in image name while building the Image .
For example following plugin configuration was giving me error .
The Issue got resolved by changing the "dockerAgent" to dockeragent (all letters in small cases).
oliviercwa commentedon Nov 22, 2018
I had the same issue running Docker and Maven on Windows. My configuration tag was
${docker.image.prefix}/${project.artifactId}
...
And the ${project.artifactId} resolved to a name that had capital letters.
This led to the error "Cannot retry request with a non-repeatable request entity: Connection reset by peer: socket write error -> [Help 1]".
Changing the docker image to lowercase fixed it.
Thanks abhisheknn
rmoutray-configureone commentedon Dec 6, 2018
For me the issue was an extra
/
in the name. My configuration was${docker.image.prefix}/${project.artifactId}
, and the prefix itself already had a/
.liujunshi commentedon Dec 10, 2018
set class path //设置环境变量
DOCKER_HOST=unix:///var/run/docker.sock
or add args before CMD //或者增加启动参数
DOCKER_HOST=unix:///var/run/docker.sock mvn clean install docker:build
ShreyasDeshpande commentedon Jan 9, 2019
It worked for me as well. Thanks a ton :)
BhanuPrakash531 commentedon Jan 31, 2019
Issue got resolved by changing the upper case to smaller case on the artifact id which is used for the docker image name. Thanks
martinvw commentedon Feb 19, 2019
I believe this issue should re-opened, there is totally no error message that indicates a problem with uppercase / lowercase. This should be fixed in the plugin.
abdulazizalmalki-gh commentedon Apr 12, 2019
This fixed it for me. seems to be an issue with the plugin
DRoppelt commentedon May 27, 2019
I can confirm that changing the repository-name to my own value (instead of project.artifactId) fixed this. The
${project.groupId}/${project.artifactId}
has upper-case chars.to
reddyraja86 commentedon Jul 15, 2019
mohanr commentedon Jul 21, 2019
Don't understand why we don't think such issues are a serious thread to open-source in contemporary software.
shreekrishna905 commentedon May 23, 2020
Work for me. It is very simple issue. check name of your project.
I have name in Uppercase like this name = Xyz. I change to lower case and every thing work fine. ${project.name} = xyz . Thank you all
venkatnaveen7 commentedon Jul 28, 2020
I too had the same problem
We need not remove the capital cases I belive
dockerfile plug in uses project version
my pom.xml was having 0.0.1-SNAPSHOT and i changed it to 0.0.1.SNAPSHOT and images built succesfully