Answers: <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>
  
Answers: CC BY-SA 4.0
Answers: 2019-02-23T23:10:23.973Z
Answers: 2019-02-23T23:10:23.973Z
Answers: Alain BECKER
Body: <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>
  
Tags: <docker><maven>
Title: Docker machine connection with https
UserDisplayName: user2829093
ThreadText: # 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:-
  
  ```xml
  
  <plugin>
      <groupId>com.spotify</groupId>
      <artifactId>docker-maven-plugin</artifactId>
      <version>0.4.11</version>
      <configuration>
          <repository>${docker.image.prefix}/${project.artifactId}</repository>
          <imageName>${docker.image.prefix}/${project.artifactId}</imageName>
          <dockerDirectory>${project.basedir}/src/docker</dockerDirectory>
          <dockerHost>https://192.168.99.102:2376</dockerHost>
          <dockerCertPath>C:/Users/shridhar/.docker/machine/machines/default</dockerCertPath>
          <forceTags>true</forceTags>
          <imageTags>
              <imageTag>${projectVersion}</imageTag>
              <imageTag>latest</imageTag>
          </imageTags>
  
          <!-- push the image on docker hub -->
          <serverId>docker-hub</serverId>
          <registryUrl>https://hub.docker.com</registryUrl>
          <resources>
              <resource>
                  <!-- war file locaion wheere war should be present (copied) -->
                  <targetPath>/   </targetPath>
                  <directory>${project.build.directory}</directory>
                  <include>${project.build.finalName}.war</include>
              </resource>
          </resources>
      </configuration>
  </plugin>
  
  ```
  
  Docker machine details
  
  ```bash
  $ 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
  
  ```xml
  <dockerHost>tcp://192.168.99.102:2376</dockerHost>
  
  ```
  
  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`
  
  
  ---
  
  