title: Maven docker plugin for spring boot build error
body: <p>I have a simple <code>maven project</code> with multi modules (only one for the moment) for <code>Spring Boot microservices</code></p>
  
  <p>In the <code>root folder</code> the <code>pom.xml</code> contains</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;be.demo.microservices&lt;/groupId&gt;
      &lt;artifactId&gt;master&lt;/artifactId&gt;
      &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;pom&lt;/packaging&gt;
      &lt;modules&gt;
          &lt;module&gt;hello-service&lt;/module&gt;
      &lt;/modules&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>In the <code>hello-service folder</code>, the <code>pom.xml</code> contains</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;be.demo.microservices&lt;/groupId&gt;
      &lt;artifactId&gt;hello-service&lt;/artifactId&gt;
      &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;description&gt;Demo project for Spring Boot&lt;/description&gt;
  
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.0.1.RELEASE&lt;/version&gt;
          &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
          &lt;docker.image.prefix&gt;springio&lt;/docker.image.prefix&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;com.spotify&lt;/groupId&gt;
                  &lt;artifactId&gt;docker-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;1.0.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;imageName&gt;${docker.image.prefix}/${project.artifactId}&lt;/imageName&gt;
                      &lt;imageTags&gt;
                          &lt;imageTag&gt;${project.version}&lt;/imageTag&gt;
                          &lt;imageTag&gt;latest&lt;/imageTag&gt;
                      &lt;/imageTags&gt;
                      &lt;baseImage&gt;openjdk:8-jdk-alpine&lt;/baseImage&gt;
                      &lt;entryPoint&gt;["sh","-c","java -Djava.security.egd=file:/dev/./urandom -jar /${project.build.finalName}.jar"]&lt;/entryPoint&gt;
                      &lt;resources&gt;
                          &lt;resource&gt;
                              &lt;targetPath&gt;/&lt;/targetPath&gt;
                              &lt;directory&gt;${project.build.directory}&lt;/directory&gt;
                          &lt;include&gt;${project.build.finalName}.jar&lt;/include&gt;
                          &lt;/resource&gt;
                      &lt;/resources&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>When building the project with <code>mvn clean package docker:build</code> I have</p>
  
  <pre><code>...
  [INFO] --- spring-boot-maven-plugin:2.0.1.RELEASE:repackage (default) @ hello-service ---
  [INFO]
  [INFO] --- docker-maven-plugin:1.0.0:build (default-cli) @ hello-service ---
  [INFO] Using authentication suppliers: [ConfigFileRegistryAuthSupplier]
  [INFO] Copying D:\dev\microservices\demo\hello-service\target\hello-service-1.0.0-SNAPSHOT.jar -&gt; D:\dev\microservices\demo\hello-service\target\docker\hello-service-1.0.0-SNAPSHOT.jar
  [INFO] Building image springio/hello-service
  Step 1/3 : FROM openjdk:8-jdk-alpine
  
   ---&gt; 224765a6bdbe
  Step 2/3 : ADD /hello-service-0.0.1-SNAPSHOT.jar //
  
   ---&gt; 259b1622e107
  Step 3/3 : ENTRYPOINT ["sh","-c","java -Djava.security.egd=file:/dev/./urandom -jar /hello-service-1.0.0-SNAPSHOT.jar"]
  
   ---&gt; Running in e86870c47b6a
  Removing intermediate container e86870c47b6a
   ---&gt; 847840116367
  ProgressMessage{id=null, status=null, stream=null, error=null, progress=null, progressDetail=null}
  Successfully built 847840116367
  Successfully tagged springio/hello-service:latest
  [INFO] Built springio/hello-service
  [INFO] Tagging springio/hello-service with 1.0.0-SNAPSHOT
  [INFO] Tagging springio/hello-service with latest
  [INFO]
  [INFO]     ------------------------------------------------------------------------
  [INFO] Building master 1.0.0-SNAPSHOT
  [INFO] ------------------------------------------------------------------------
  [INFO]
  [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ master ---
  [INFO]
  [INFO] --- docker-maven-plugin:1.0.0:build (default-cli) @ master ---
  [INFO] Using authentication suppliers: [ConfigFileRegistryAuthSupplier]
  [INFO] ------------------------------------------------------------------------
  [INFO] Reactor Summary:
  [INFO]
   [INFO] hello-service ...................................... SUCCESS [  9.881 s]
   [INFO] master ............................................. FAILURE [  0.102 s]
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 10.650 s
  [INFO] Finished at: 2018-04-18T13:33:49+02:00
  [INFO] Final Memory: 54M/520M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build (default-cli) on project master: Exception caught: Must specify baseImage if dockerDirectory is null -&gt; [Help 1]
  [ERROR] .....
  </code></pre>
  
  <p>So the service is packaged, the image is built but I don't understand why in the master pom maven is trying to build an image even if there is no docker plugin inside it ?</p>