<!-- docker 打包 插件 -->
-<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.11</version>
-<configuration>
<!-- 打包名称 -->
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
<!-- dockerfile 路径-->
<dockerDirectory>${project.basedir}/docker</dockerDirectory>
-<resources>
<!-- 复制 war包 docker 打包用-->
-<resource>
<targetPath>/</targetPath>
<!-- war 路径 -->
<directory>${project.basedir}/xx/target</directory>
<!-- war 文件名称 -->
<include>${project.build.finalName}.war</include>
</resource>
</resources>
</configuration>
</plugin>
dockerfile
FROM fabric8/tomcat-8
ADD ./xx.war /opt/tomcat/webapps
CMD /opt/tomcat/bin/deploy-and-run.sh
dockerfile
里面的镜像等可以根据自己需求配置