Skip to content
This repository was archived by the owner on Mar 21, 2022. It is now read-only.
This repository was archived by the owner on Mar 21, 2022. It is now read-only.

Maven-Docker Build cannot create docker image  #357

Closed
@uelker58

Description

@uelker58

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

microvesalith commented on Dec 5, 2017

@microvesalith

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

mattnworb commented on Dec 5, 2017

@mattnworb
Member

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

microvesalith commented on Dec 5, 2017

@microvesalith

echo %DOCKER_HOST%
tcp://localhost:2375

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

uelker58 commented on Dec 6, 2017

@uelker58
Author

I solved the problem by using the new plugin dockerfile-maven. Was not the deamon as previously mentioned but the plugin.

abhisheknn

abhisheknn commented on Oct 6, 2018

@abhisheknn

For me the issue was Capital letter in image name while building the Image .
For example following plugin configuration was giving me error .

<plugin>
           <groupId>com.spotify</groupId>
           <artifactId>dockerfile-maven-plugin</artifactId>
           <version>1.3.6</version>
           <configuration>
           <useConfigFile>false</useConfigFile>
           <useMavenSettingsForAuth>true</useMavenSettingsForAuth>	
               <repository>${docker.image.prefix}/dockerAgent</repository>
           <buildArgs>
   	<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
   		</buildArgs>
           </configuration>
   <executions>
   <execution>
   	<id>default</id>
   	<phase>install</phase>
   	<goals>
   		<goal>build</goal>
   	</goals>
   </execution>
   </executions>
       </plugin> 

The Issue got resolved by changing the "dockerAgent" to dockeragent (all letters in small cases).

oliviercwa

oliviercwa commented on Nov 22, 2018

@oliviercwa

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

rmoutray-configureone commented on Dec 6, 2018

@rmoutray-configureone

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

liujunshi commented on Dec 10, 2018

@liujunshi

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

ShreyasDeshpande commented on Jan 9, 2019

@ShreyasDeshpande

For me the issue was Capital letter in image name while building the Image .
For example following plugin configuration was giving me error .

<plugin>
           <groupId>com.spotify</groupId>
           <artifactId>dockerfile-maven-plugin</artifactId>
           <version>1.3.6</version>
           <configuration>
           <useConfigFile>false</useConfigFile>
           <useMavenSettingsForAuth>true</useMavenSettingsForAuth>	
               <repository>${docker.image.prefix}/dockerAgent</repository>
           <buildArgs>
   	<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
   		</buildArgs>
           </configuration>
   <executions>
   <execution>
   	<id>default</id>
   	<phase>install</phase>
   	<goals>
   		<goal>build</goal>
   	</goals>
   </execution>
   </executions>
       </plugin> 

The Issue got resolved by changing the "dockerAgent" to dockeragent (all letters in small cases).

It worked for me as well. Thanks a ton :)

BhanuPrakash531

BhanuPrakash531 commented on Jan 31, 2019

@BhanuPrakash531

For me the issue was Capital letter in image name while building the Image .

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

martinvw commented on Feb 19, 2019

@martinvw

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

abdulazizalmalki-gh commented on Apr 12, 2019

@abdulazizalmalki-gh

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

This fixed it for me. seems to be an issue with the plugin

DRoppelt

DRoppelt commented on May 27, 2019

@DRoppelt

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.

<plugin>
  <groupId>com.spotify</groupId
  <artifactId>dockerfile-maven-plugin</artifactId>
  <version>1.4.10</version>
...
  <configuration>
    <repository>${project.groupId}/${project.artifactId}</repository>
    <tag>${project.version}</tag>
  </configuration>
</plugin>

to

<plugin>
  <groupId>com.spotify</groupId
  <artifactId>dockerfile-maven-plugin</artifactId>
  <version>1.4.10</version>
...
  <configuration>
    <repository>domain/my_project_name</repository>
    <tag>${project.version}</tag>
  </configuration>
</plugin>
reddyraja86

reddyraja86 commented on Jul 15, 2019

@reddyraja86

For me the issue was Capital letter in image name while building the Image .
For example following plugin configuration was giving me error .

<plugin>
           <groupId>com.spotify</groupId>
           <artifactId>dockerfile-maven-plugin</artifactId>
           <version>1.3.6</version>
           <configuration>
           <useConfigFile>false</useConfigFile>
           <useMavenSettingsForAuth>true</useMavenSettingsForAuth>	
               <repository>${docker.image.prefix}/dockerAgent</repository>
           <buildArgs>
   	<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
   		</buildArgs>
           </configuration>
   <executions>
   <execution>
   	<id>default</id>
   	<phase>install</phase>
   	<goals>
   		<goal>build</goal>
   	</goals>
   </execution>
   </executions>
       </plugin> 

The Issue got resolved by changing the "dockerAgent" to dockeragent (all letters in small cases).

It worked for me as well. Thanks a ton :)

This solved the issue.Thanks.

mohanr

mohanr commented on Jul 21, 2019

@mohanr

Don't understand why we don't think such issues are a serious thread to open-source in contemporary software.

shreekrishna905

shreekrishna905 commented on May 23, 2020

@shreekrishna905

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

venkatnaveen7 commented on Jul 28, 2020

@venkatnaveen7

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mattnworb@mohanr@martinvw@abdulazizalmalki-gh@DRoppelt

        Issue actions

          Maven-Docker Build cannot create docker image · Issue #357 · spotify/docker-maven-plugin