Wednesday, July 5, 2017

com.spotify docker-maven-plugin used error and problem draft


My xml with:


 <properties>
        <docker.image.prefix>springio</docker.image.prefix>
        <docker.plugin.version>1.0.0</docker.plugin.version>
        <docker.repostory>192.168.3.131:5000</docker.repostory>
        <DOCKER_HOST>tcp://192.168.3.131:2376</DOCKER_HOST>
 </properties>

<build>      

       <plugins>

           <plugin>

               <groupId>org.springframework.boot</groupId>

               <artifactId>spring-boot-maven-plugin</artifactId>

               <executions>

                   <execution>

                       <goals>

                           <goal>repackage</goal>

                       </goals>

                   </execution>

               </executions>

           </plugin>

           <plugin>

               <groupId>com.spotify</groupId>

               <artifactId>docker-maven-plugin</artifactId>

               <version>${docker.plugin.version}</version>

              

               <configuration>

                   <imageName>${project.artifactId}</imageName>

                   <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>

                   <resources>

                       <resource>

                           <targetPath>/</targetPath>

                           <directory>${project.build.directory}</directory>

                           <include>${project.build.finalName}.jar</include>

                       </resource>

                   </resources>

               </configuration>

              

               <executions>

                 <execution>

          <id>build-image</id>

          <phase>package</phase>

          <goals>

            <goal>build</goal>

          </goals>

        </execution>

        <execution>

          <id>tag-image</id>

          <phase>package</phase>

          <goals>

            <goal>tag</goal>

          </goals>

                   <configuration>

                    <image>${project.artifactId}</image>

                     <newName>${docker.repostory}/${project.artifactId}</newName>

                   </configuration>

        </execution>

        <execution>

          <id>push-image</id>

          <phase>deploy</phase>

          <goals>

            <goal>push</goal>

          </goals>

          <configuration>

            <imageName>${docker.repostory}/${project.artifactId}</imageName>

          </configuration>

        </execution>

               </executions>

           </plugin>

       </plugins>

   </build>


Error:
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:tag (default-cli) on project pkrss-microsrv-consul:
 The parameters 'image', 'newName' for goal com.spotify:docker-maven-plugin:1.0.0:tag are missing or invalid -> [Help 1]

Why:
i used below command, and lost package.
$ mvn docker:tag -D pushImage


Error:
The push registry is docker.io not my self local registry responsity.
The push refers to a repository [docker.io/library/pkrss-microsrv-consul]


Why:
i used below command, and not have docker:build:
mvn package docker:tag -D pushImage

Suggest:

$ mvn clean package docker:build -D pushImageTags
clean command also can skip.
It is ok.

Last:
Thanks!

No comments: