Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven package docker:build - connection refused

Tags:

java

docker

maven

I am trying to directly build a docker image with maven with mvn package docker:build.

Docker is running and docker ps shows me my containers, so I assume that everything is running correctly. I do get the following error though:

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.2.3:build (default-cli) on project reservierung: Exception caught: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: o rg.apache.http.conn.HttpHostConnectException: Connect to localhost:2375 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect ->

My first approach was that since I am working on windows I need to call the docker-machine ip address instead of localhost, but that also didn't work. I am kind of at a loss here, because I assume that it's something simple that I am doing wrong, but I cannot find anything about the connection refused error when docker is (seemingly) running properly.

I am sorry if this is trivial.

like image 823
KaffeeKaethe Avatar asked Feb 22 '16 09:02

KaffeeKaethe


2 Answers

On Windows with Docker/Hyper-V this occurred to me with com.spotify:docker-maven-plugin:1.0.0. There is a discussion about this on another forum, where they advise to turn on enter image description here

in docker Settings/General Tab. It worked for me.

like image 88
jan.supol Avatar answered Sep 21 '22 10:09

jan.supol


i solve the problem using this setting:

<configuration>
	<imageName>10.10.8.175:5000/${artifactId}:${project.version}</imageName>
	<dockerHost>https://192.168.99.100:2376</dockerHost>
	<dockerCertPath>C:\Users\AtomView\.docker\machine\machines\default</dockerCertPath>
	<dockerDirectory>src/main/resources/docker</dockerDirectory>
	<resources>
		<resource>
			<targetPath>/</targetPath>
			<directory>${project.build.directory}</directory>
			<include>*.zip</include>
		</resource>
	</resources>
</configuration>
like image 39
湛永志 Avatar answered Sep 20 '22 10:09

湛永志