Docker创建、运行微服务镜像
- 本地Maven添加Docker插件往本地Docker上创建、运行镜像
本地环境要求:
Maven
Java
Docker
1)pom添加docker plugin
<properties>
<docker.image.prefix>springboot</docker.image.prefix>
<docker.maven.plugin.version> 1.2.2</docker.maven.plugin.version>
</properties>
<!-- Docker maven plugin -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker.maven.plugin.version}</version>
<configuration>
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
<dockerDirectory>src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>