<p>Considering you say you want to build an image (and not push it to Docker hub or wherever):</p>

<p><a href="https://github.com/spotify/docker-maven-plugin" rel="nofollow noreferrer">docker-maven-plugin</a> project recommends using <a href="https://github.com/spotify/dockerfile-maven" rel="nofollow noreferrer">dockerfile-maven</a> for new projects, as the former</p>

<blockquote>
  <p>[...] ultimately led to a lot of unnecessary confusion with our users that stemmed from introducing extra abstractions and a need for configuration on top of what Docker is providing.</p>
</blockquote>

<p>The dockerfile-maven <code>README</code> should get you started, with both a sample <code>Dockerfile</code> and  the relevant <code>plugin</code> section for your <code>pom.xml</code></p>

CC BY-SA 4.0
2019-02-23T23:10:23.973Z
2019-02-23T23:10:23.973Z
Alain BECKER
<p>I am new to Docker. I installed Docker tool box on my Windows machine.</p>

<p>Using pom.xml I want to generate docker image .
pom.xml:-</p>

<pre class="lang-xml prettyprint-override"><code>
&lt;plugin&gt;
    &lt;groupId&gt;com.spotify&lt;/groupId&gt;
    &lt;artifactId&gt;docker-maven-plugin&lt;/artifactId&gt;
    &lt;version&gt;0.4.11&lt;/version&gt;
    &lt;configuration&gt;
        &lt;repository&gt;${docker.image.prefix}/${project.artifactId}&lt;/repository&gt;
        &lt;imageName&gt;${docker.image.prefix}/${project.artifactId}&lt;/imageName&gt;
        &lt;dockerDirectory&gt;${project.basedir}/src/docker&lt;/dockerDirectory&gt;
        &lt;dockerHost&gt;https://192.168.99.102:2376&lt;/dockerHost&gt;
        &lt;dockerCertPath&gt;C:/Users/shridhar/.docker/machine/machines/default&lt;/dockerCertPath&gt;
        &lt;forceTags&gt;true&lt;/forceTags&gt;
        &lt;imageTags&gt;
            &lt;imageTag&gt;${projectVersion}&lt;/imageTag&gt;
            &lt;imageTag&gt;latest&lt;/imageTag&gt;
        &lt;/imageTags&gt;

        &lt;!-- push the image on docker hub --&gt;
        &lt;serverId&gt;docker-hub&lt;/serverId&gt;
        &lt;registryUrl&gt;https://hub.docker.com&lt;/registryUrl&gt;
        &lt;resources&gt;
            &lt;resource&gt;
                &lt;!-- war file locaion wheere war should be present (copied) --&gt;
                &lt;targetPath&gt;/   &lt;/targetPath&gt;
                &lt;directory&gt;${project.build.directory}&lt;/directory&gt;
                &lt;include&gt;${project.build.finalName}.war&lt;/include&gt;
            &lt;/resource&gt;
        &lt;/resources&gt;
    &lt;/configuration&gt;
&lt;/plugin&gt;
</code></pre>

<p>Docker machine details</p>

<pre class="lang-bash prettyprint-override"><code>$ env | grep 'DOCKER'
</code></pre>

<pre><code>DOCKER_HOST=tcp://192.168.99.102:2376
DOCKER_MACHINE_NAME=default
DOCKER_TLS_VERIFY=1
DOCKER_TOOLBOX_INSTALL_PATH=C:\Program Files\Docker Toolbox
DOCKER_CERT_PATH=C:\Users\shridhar\.docker\machine\machines\default
</code></pre>

<p>I get the below exception:</p>

<pre><code>Caused by: com.spotify.docker.client.exceptions.DockerException: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: org.apache.http.client.ClientProtocolException
</code></pre>

<p>If I make tcp connection</p>

<pre class="lang-xml prettyprint-override"><code>&lt;dockerHost&gt;tcp://192.168.99.102:2376&lt;/dockerHost&gt;
</code></pre>

<p>then I get below exception:</p>

<pre><code>Caused by: java.lang.IllegalArgumentException: An HTTPS URI for DOCKER_HOST must be provided to use Docker client certificates
</code></pre>

<p>What changes do I have to make to build image sucessfully?</p>

<docker><maven>
Docker machine connection with https
user2829093
# Docker machine connection with https

(Asked by: username_0 on 2019-01-27)

I am new to Docker. I installed Docker tool box on my Windows machine.
Using pom.xml I want to generate docker image .
pom.xml:-


    com.spotify
    docker-maven-plugin
    0.4.11
    
        ${docker.image.prefix}/${project.artifactId}
        ${docker.image.prefix}/${project.artifactId}
        ${project.basedir}/src/docker
        https://192.168.99.102:2376
        C:/Users/shridhar/.docker/machine/machines/default
        true
        
            ${projectVersion}
            latest
        

        
        docker-hub
        https://hub.docker.com
        
            
                
                /   
                ${project.build.directory}
                ${project.build.finalName}.war
            
        
    


Docker machine details
$ env | grep 'DOCKER'

DOCKER_HOST=tcp://192.168.99.102:2376
DOCKER_MACHINE_NAME=default
DOCKER_TLS_VERIFY=1
DOCKER_TOOLBOX_INSTALL_PATH=C:\Program Files\Docker Toolbox
DOCKER_CERT_PATH=C:\Users\shridhar\.docker\machine\machines\default

I get the below exception:
Caused by: com.spotify.docker.client.exceptions.DockerException: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: org.apache.http.client.ClientProtocolException

If I make tcp connection
tcp://192.168.99.102:2376

then I get below exception:
Caused by: java.lang.IllegalArgumentException: An HTTPS URI for DOCKER_HOST must be provided to use Docker client certificates

What changes do I have to make to build image sucessfully?

**Tags:** docker, maven


---

## 1 answers

### Answer by username_1 on 2019-02-23. Score: 1

Considering you say you want to build an image (and not push it to Docker hub or wherever):

[docker-maven-plugin](https://github.com/spotify/docker-maven-plugin) project recommends using [dockerfile-maven](https://github.com/spotify/dockerfile-maven) for new projects, as the former

> [...] ultimately led to a lot of unnecessary confusion with our users that stemmed from introducing extra abstractions and a need for configuration on top of what Docker is providing.

The dockerfile-maven `README` should get you started, with both a sample `Dockerfile` and the relevant `plugin` section for your `pom.xml`


---

