本地jar包上传docker容器
先安装docker的注册服务器:
[root@VM_0_7_centos ~]# docker run -d -p : --restart=always --name registry2 registry:
开启docker远程api:
[root@VM_0_7_centos ~]# vi /usr/lib/systemd/system/docker.service
原来文件描述符fd方式改为tcp,指定端口2375:
让docker支持http上传镜像文件(我们本地的jar包):
[root@VM_0_7_centos ~]# echo '{ "insecure-registries":["110.111.119.10:5000"] }' > /etc/docker/daemon.json
注意:这里的110.111.119.10是你docker所在服务器的ip。
重启docker:
[root@VM_0_7_centos ~]# systemctl daemon-reload && systemctl restart docker
本地jar包的pom文件引入docker插件:
<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.1.</version>
<executions>
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<imageName>wlf/${project.artifactId}:${project.version}</imageName>
<dockerHost>http://110.111.119.10:2375</dockerHost>
<baseImage>java:</baseImage>
<entryPoint>["java", "-jar", "-Dspring.profiles.active=prod","/${project.build.finalName}.jar"]
</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
注意:dockerHost的ip就是docker所在服务器的ip,端口号是2375。直接跑maven:
[INFO] Building wlf-test 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.:resources (default-resources) @ wlf-test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying resources
[INFO] Copying resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.:compile (default-compile) @ wlf-test ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.1.:testResources (default-testResources) @ wlf-test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory E:\workspace\wlf\wlf-test\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.:testCompile (default-testCompile) @ wlf-test ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.:test (default-test) @ wlf-test ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:3.1.:jar (default-jar) @ wlf-test ---
[INFO] Building jar: E:\workspace\wlf\wlf-test\target\wlf-test-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.1..RELEASE:repackage (repackage) @ wlf-test ---
[INFO] Replacing main artifact with repackaged archive
[INFO]
[INFO] --- docker-maven-plugin:1.1.:build (build-image) @ wlf-test ---
[INFO] Using authentication suppliers: [ConfigFileRegistryAuthSupplier]
[INFO] Copying E:\workspace\wlf\wlf-test\target\wlf-test-1.0-SNAPSHOT.jar -> E:\workspace\wlf\wlf-test\target\docker\wlf-test-1.0-SNAPSHOT.jar
[INFO] Building image wlf/wlf-test:1.0-SNAPSHOT
Step / : FROM java: ---> d23bdf5b1b1b
Step / : ADD /wlf-test-1.0-SNAPSHOT.jar // ---> 1c5c2b47b5fb
Step / : ENTRYPOINT ["java", "-jar", "-Dspring.profiles.active=prod","/wlf-test-1.0-SNAPSHOT.jar"] ---> Running in 3a0ae2be2945
Removing intermediate container 3a0ae2be2945
---> 372d06d19472
ProgressMessage{id=null, status=null, stream=null, error=null, progress=null, progressDetail=null}
Successfully built 372d06d19472
Successfully tagged wlf/wlf-test:1.0-SNAPSHOT
本地jar包上传docker容器的更多相关文章
- Maven中安装本地Jar包到仓库中或将本地jar包上传
摘要 maven install 本地jar 命令格式 mvn install:install-file -DgroupId=<group_name> -DartifactId=<a ...
- 使用mvn deploy命令将本地jar包上传到maven私服
记录一下,以后少走弯路 前提:已经搭建好nexus maven私服,地址192.168.110.240:9091 在maven的setting.xml中找到<mirrors></mi ...
- 用eclipse怎样将本地的项目打成jar包上传到maven仓库
使用maven的项目中,有时需要把本地的项目打成jar包上传到mevan仓库. 操作如下: 前提:pom文件中配置好远程库的地址,否则会报错 1.将maven 中的settings文件配置好用户名和密 ...
- nexus搭建maven私服及私服jar包上传和下载
nexus搭建maven私服及私服jar包上传和下载 标签: nexus管理maven库snapshot 2017-06-28 13:02 844人阅读 评论(0) 收藏 举报 分类: Maven(1 ...
- maven jar包上传到服务器
maven jar包上传到服务器时出现pom文件没有上传上去,致使该jar包再被使用的时候没有依赖,jar包调用出错 解决办法,将pom文件一起deploy上去 mvn deploy:deploy-f ...
- Apache Flink任意Jar包上传导致远程代码执行漏洞复现
0x00 简介 Apache Flink是由Apache软件基金会开发的开源流处理框架,其核心是用Java和Scala编写的分布式流数据流引擎.Flink以数据并行和流水线方式执行任意流数据程序,Fl ...
- IDEA如何将写好的java类(UDF函数)打成jar包上传linux
一.编写一个UDF函数,实现将字符串大写转小写 import org.apache.hadoop.hive.ql.exec.UDF; import org.apache.hadoop.io.Text; ...
- 构建自己的jar包上传至Mvaen中央仓库和版本更新
构建自己的jar包上传至Mvaen中央仓库和版本更新 一直羡慕别人制造轮子,开源项目,供别人使用:我也想这样,可以自己才疏学浅,本次就将自己写小工具上传到Maven的中央仓库. 一步一步详细教程演示如 ...
- Apache Flink Dashboard未授权访问导致任意Jar包上传漏洞
漏洞危害 攻击者无需Flink Dashboard认证,通过上传恶意jar包 csdn-[漏洞复现]Apache Flink任意Jar包上传导致远程代码执行 freebuf-Apache Flink ...
随机推荐
- C语言基础知识-程序流程结构
C语言基础知识-程序流程结构 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.概述 C语言支持最基本的三种程序运行结构:顺序结构,选择结构,循环结构. 顺序结构:程序按顺序执行, ...
- python笔记38-使用zmail发各种邮件案例代码
前言 本篇介绍使用zmail发各种格式的邮件,并运行成功的代码,小伙伴们只需更换自己的邮箱就可以运行起来了 content_text发送纯文本 先从最简单的发送纯文本的邮件开始,调通发送邮件的代码. ...
- 史上最完整promise源码手写实现
史上最完整的promise源码实现,哈哈,之所以用这个标题,是因为开始用的标题<手写promise源码>不被收录 promise自我介绍 promise : "君子一诺千金,承诺 ...
- wordpress调用缩略图/特色图url
调用缩略图的url <a href="<?php the_post_thumbnail_url( 'full' ); ?>"><?php the_po ...
- VFLEXGRID8控件注册
[转][两套控件]Vsflexgrid8.0和Vsview8.0 最新注册版 Vsflexgrid8.0(制作网格,树型目录.合并等) -------------------------------- ...
- 分析第一个Android程序
项目结构切换Project, 项目真实目录结构 { 1. .gradle和idea 两个目录放置的都是Android Studio 自动生成的一些文件,我们无需关心,也不要去手动编辑. 2.AP ...
- LeetCode 931. Minimum Falling Path Sum
原题链接在这里:https://leetcode.com/problems/minimum-falling-path-sum/ 题目: Given a square array of integers ...
- idea中properties配置文件 注释显示中文乱码问题
- centos7最小化安装无法tab补全
yum install -y bash-completion 安装完后reboot重启生效
- Jmeter 正则表达式提取器详解(Regular Expression Exactor)
Jmeter 正则表达式提取器详解(Regular Expression Exactor) Name(名称):随意设置,最好有业务意义. Comments(注释):随意设置,可以为空 Apply to ...