私有仓库安装成功:
从私有仓库下载镜像:
docker pull 192.168.184.141:5000/jdk1.8
springboot项目配置生成docker镜像:
web模块pom文件添加以下配置
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <!-- 指定该Main Class为全局的唯一入口 --> <mainClass>com.hxb.HuWebApplication</mainClass> <layout>ZIP</layout> </configuration> <executions> <execution> <goals> <goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中--> </goals> </execution> </executions> </plugin> <plugin> <groupId>com.spotify</groupId> <artifactId>docker-maven-plugin</artifactId> <version>0.4.13</version> <configuration> <imageName>106.53.0.111:5000/${project.artifactId}:${project.version}</imageName> <baseImage>jdk1.8</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> <dockerHost>http://106.53.0.111:2375</dockerHost> </configuration> </plugin> </plugins> </build>
在命令行执行:
mvn docker:build -DpushImage
即可。