Docker Community Forums

Share and learn in the Docker community.

DOCKER_HOST missing for Maven Plugins

beta

(Hberndt) #1

v1.11.1-beta14.5 works fine and as expected on Mac OS. Conversion of existing images works as expected and the container works good.
For my local build process with maven plugins I need a DOCKER_HOST environment. Starting a different machine is a bad option.
Is there a way to set DOCKER_HOST for maven plugins?


(Escheuter) #2

You can set it inside the configuration-section;
<groupId>com.spotify</groupId> <artifactId>docker-maven-plugin</artifactId> <version>0.4.10</version> <configuration> <skipDockerBuild>true</skipDockerBuild> <imageName>lala/${project.artifactId}</imageName> <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory> <dockerHost>PUT_IT_HERE</dockerHost> <resources> <resource> <directory>${project.build.directory}</directory> <include>${project.build.finalName}.jar</include> </resource> </resources> </configuration>


(Hberndt) #3

This is clear so far. But with the new docker toolbox I do not know which IP to use. Is localhost possible?


(Escheuter) #4

When building locally (eg mvn docker:build), I don’t need to set DOCKER_HOST. I think it’s using unix:///var/run/docker.sock (DOCKER_HOST=“unix:///var/run/docker.sock”) by default.
You can set it to tcp://127.0.0.1:2376 (or https) as well.


(Hberndt) #5

Thank you for advice. This does not work. Connection is refused.


(Escheuter) #6

Are you using the latest version of the docker for maven plugin (0.4.10)?
Only “connection refused” is displayed and your tried both (unix:// & tcp://) options?
Last thing I can think of is renaming or deleting the .docker directory and try it again.


(Hberndt) #7

We are using jolokia maven plugin. We will try spotify plugin soon.

Thanks for advice.