<!-- 添加spring-boot的maven插件 -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<executions>
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<!--<!– 配置docker server 位置,否则默认127.0.0.1,报org.apache.http.conn.HttpHostConnectException: Connect to localhost:2375 [localhost/127.0.0.1] failed–>-->
<dockerHost>http://192.168.23.7:2375</dockerHost>
<!--<!– 注意imageName一定要是符合正则[a-z0-9-_.]的,否则构建不会成功 –>-->
<imageName>itmuch/microservice-discovery-eureka:0.0.4</imageName>
<!-- Dockerfile 文件位置 -->
<!--<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>-->
<baseImage>java</baseImage>
<entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
执行 install 将自动推送到 服务器上 执行 docker images可以看到相应的镜像