在進行docker部署的時候,開始對項目進行打包,在啓動該鏡像時spring
[root@topcheer docker]# docker run -it 00494e3d4550
no main manifest attribute, in /app.jardocker
提示沒有入口類信息app
項目基於maven pom多模塊的開發的,須要設置goal-repackage屬性爲true,不然打包後文件依賴文件沒有一塊兒打包,而後鏡像內沒有能夠運行的程序文件maven
以下:2個打包插件都要,否則只有docker的會致使打包不完整。spring-boot
<plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <!--加入下面兩項配置--> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> <configuration> <includeSystemScope>true</includeSystemScope> </configuration> </plugin> <plugin> <groupId>com.spotify</groupId> <artifactId>docker-maven-plugin</artifactId> <version>1.2.0</version> <executions> <execution> <phase>package</phase> <goals> <goal>build</goal> </goals> </execution> <execution> <id>tag-image</id> <phase>package</phase> <goals> <goal>tag</goal> </goals> <configuration> <image>${docker.repostory}/${docker.image.prefix}/${project.artifactId}:1.0.1</image> <newName>${docker.repostory}/${docker.image.prefix}/${project.artifactId}:1.0.1</newName> </configuration> </execution>