maven build docker image
- add docker maven to pom.xml
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<configuration>
<imageName>${project.name}:${project.version}</imageName>
<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>
<!--docker宿主机的ip,要为docker开通tcp访问才有效-->
<!--<dockerHost>http://8.129.181.68:2375</dockerHost>-->
<dockerHost>http://localhost:2375</dockerHost>
</configuration>
</plugin>
- exec cmd below
sudo mvn clean install
sudo mvn docker:build