springboot 通过docker 打包编译镜像
添加plugin
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>peacock</artifactId>
<groupId>cn.xiaojf</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.</modelVersion> <artifactId>peacock-eureka</artifactId> <properties>
<docker.registry.host>192.168.1.57:5000</docker.registry.host>
</properties> <dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency> <dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>${spring-boot-admin.version}</version>
</dependency>
</dependencies> <build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.2.0</version>
<configuration>
<!-- 镜像名称 -->
<imageName>${docker.registry.host}/${project.artifactId}:${project.version}</imageName>
<!-- 基础镜像 -->
<baseImage>java:8-jre-alpine</baseImage>
<!--Dockerfile的位置 -->
<!--<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>-->
<!-- 容器启动后执行命令 -->
<entryPoint>["java", "-jar", "/${project.build.finalName}.jar","--spring.profiles.active=prod"]</entryPoint>
<!-- 复制jar包到镜像中 -->
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<imageTags>
<imageTag>${project.version}</imageTag>
<imageTag>latest</imageTag>
</imageTags>
</configuration>
<executions>
<execution>
<id>build-image</id>
<phase>install</phase>
<goals>
<goal>build</goal>
</goals>
</execution> <execution>
<id>push-image</id>
<phase>install</phase>
<goals>
<goal>push</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </build> </project>
执行build命令

发布镜像到私有registry
查看结果
meiya@meiya:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
192.168.1.57:5000/peacock-eureka 1.0-SNAPSHOT 339ecba6521d 12 minutes ago 163MB
jrebel-ls latest 4ef60f55bcc3 About an hour ago 115MB
192.168.1.57:/tomcat latest 27600aa3d7f1 hours ago 463MB
tomcat latest 27600aa3d7f1 hours ago 463MB
registry latest f32a97de94e1 months ago .8MB
java -jre-alpine fdc893b19a14 years ago 108MB
查看私服
meiya@meiya:~$ curl http://localhost:5000/v2/_catalog
{"repositories":["peacock-eureka","tomcat"]}
springboot 通过docker 打包编译镜像的更多相关文章
- SpringBoot 部署 docker 打包镜像
SpringBoot 部署 docker 打包镜像 环境: 1.代码编写工具:IDEA 2.打包:maven 3.docker 4.linux 7.JDK1.8 8.Xshell 9.Xftp 第一步 ...
- windows环境下,spring boot服务使用docker打包成镜像并推送到云服务器私有仓库
最近在淘宝上学习springcloud教程,其中有几节课是讲解讲本地springboot服务打包成镜像并推送到云服务器私有仓库,但是教程里面用的事Mac环境,我的是Windows环境,而且课程里面没有 ...
- 将springboot jar应用打包成镜像并在docker运行成容器
先看一下我的Dockerfile内容与服务器中的目录结构 上面 yibai-0.0.1-SNAPSHOT.jar 为springboot应用打成的jar包,Dockerfile为将应用打成镜像的配置文 ...
- 把java(springboot)程序打包docker镜像
前言:要在docker运行java(jar包)程序,就要把程序打包成docker镜像(以下简称镜像),可以先理解为镜像就是jar包 打包需要程序代码,java本身的打包环境(包括jdk和maven), ...
- Docker容器打包成镜像 - OpenDaylight官方 SDN Hub Tutorial VM 的docker镜像
由于工作需要,在看OpenDaylight (一个SDN的开源控制器) 官方Tutorial有一个比较基础且介绍比较详细的文档(http://sdnhub.org/tutorials/opendayl ...
- 基于vue+springboot+docker网站搭建【七】制作后端spring-boot的docker镜像部署
制作spring-boot的docker镜像并部署 一.下载后端项目:https://github.com/macrozheng/mall 二.修改mall-admin项目的配置文件 修改applic ...
- docker 将正在运行的容器打包为镜像
将容器打包成镜像 docker commit -a "runoob.com" -m "my apache" 容器名称或id 打包的镜像名称:标签 OPTIONS ...
- 生产环境项目问题记录系列(二):Docker打包镜像Nuget包因权限问题还原失败
docker打包镜像遇到一个因为nuget权限验证问题导致镜像打包失败的问题,公司Nuget包用的是tfs管理的,tfs有权限验证,结果导致nuget还原失败,原有的NuGet.config文件如下: ...
- docker:打包node+npm+pm2运行环境镜像
最近公司有一个外包项目需要在不能连外网的情况下部署node项目到甲方公司内部.直接使用node官网的安装包可以获得node运行环境,但像pm2这种工具要离线装就会比较费劲,所以最终选择了使用docke ...
随机推荐
- emacs源码安装
1.源码下载地址=>下载 选择下载的版本,我下的是emacs-26.1.tar.xz 版本 2.解压 xz -d emacs-26.1.tar.xz # 解压成tar文件 tar -xvf em ...
- Comet OJ - Contest #9 & X Round 3题解
传送门 \(A\) 咕咕 typedef long long ll; int a1,a2,n,d;ll res; int main(){ scanf("%d%d%d",&a ...
- PHP隐藏入口脚本文件index.php
一.nginx下 隐藏入口文件时,配置nginx 首先得开启nginx pathinfo模式: location ~ \.php { #去掉$ root E:/phpStudy/WWW/tp/publ ...
- zabbix监控线
echo mntr | nc 127.0.0.1 2181获取mntr的信息 换成conf将获得conf信息,从中找出需要监控项 conf: clientPort:客户端端口号 dataDir:数据文 ...
- com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-418, SQLSTATE=42610, SQLERRMC=null
写了一条sql,在db2数据库中可以执行,但是转换成mybatis的mapper文件后,在执行排序操作时报该错误. 我排序是这样写的 <if test="orderStr != nul ...
- [XLua]热更新四部曲视频教程+示例源码
基于Unity2017 xLua是由腾讯维护的一个开源项目,xLua为Unity. .Net. Mono等C#环境增加Lua脚本编程的能力,借助xLua,这些Lua代码可以方便的和C#相互调用.自20 ...
- 如何将eclipse项目导入到idea
intellij idea中文资料网上比较少,对于eclipse的项目如何导入intellij idea也没有完整的说明,本人在这里整理下,方便更多人加入到intellij idea的阵容里. 直接上 ...
- input标签在谷歌浏览器记住密码的自动填充问题
//使用autocomplete="new-password" <Input type='password' autocomplete="new-password& ...
- Xcode: Xcode中Command Line Tools的安装方法
1. 打开终端: 2. 输入命令: xcode-select --install ,如果出现下图,说明你已经安装过了,下边内容也不用看了 如果出现下图说明还没有安装,点击安装 同意协议: 稍等片刻.. ...
- Visual Studio 2019更新到16.1.6
Visual Studio 2019更新到16.1.6 此次更新主要是修复几个安全漏洞,如CVE-2019-1077(VS自动更新漏洞).CVE-2019-1075(ASP.net Core欺骗漏洞) ...