DockerMaven插件使用
修改宿主机的docker配置,让其可以远程访问vi /lib/systemd/system/docker.service其中ExecStart=后添加配置 ‐H tcp://0.0.0.0:2375 ‐H unix:///var/run/docker.sock刷新配置,重启服务systemctl daemon‐reloadsystemctl restart dockerdo...
·
-
修改宿主机的docker配置,让其可以远程访问
vi /lib/systemd/system/docker.service
其中ExecStart=后添加配置 ‐H tcp://0.0.0.0:2375 ‐H unix:///var/run/docker.sock
-
刷新配置,重启服务
systemctl daemon‐reload systemctl restart docker docker start registry
-
修改项目pom文件
<build>
<finalName>app</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring‐boot‐maven‐plugin</artifactId>
</plugin>
<!‐‐ docker的maven插件,官网:https://github.com/spotify/docker‐maven‐plugin ‐‐>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker‐maven‐plugin</artifactId>
<version>0.4.13</version>
<configuration>
<imageName>192.168.184.135: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://192.168.184.135:2375</dockerHost>
</configuration>
</plugin>
</plugins>
</build>
- 运行maven命令
mvn clean package docker:build ‐DpushImage
更多推荐
已为社区贡献3条内容
所有评论(0)