1.引入maven插件
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.4</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<repository>ip地址(push镜像的地址):5000/镜像name</repository>
<tag>${project.version}</tag>
</configuration>
</plugin>
</plugins>
</build>
2.在需要生成镜像的maven项目的根目录下载创建Dockfile文件
FROM java:8
MAINTAINER 作者信息
ENTRYPOINT ["java", "-jar", "/app.jar"]
# Add the service itself
ADD target/web-1.0-SNAPSHOT.jar /app.jar
3.使用mvn clean package dockerfile:push命令构建Docker镜像并发送到镜像仓库
所有评论(0)