概述
打包jar 包到镜像仓库:
Step 1:
[root@erp-poc-0001 v1]# pwd
/root/images/v1
[root@erp-poc-0001 v1]# ls
Dockerfile leon-app-v1.jar
[root@erp-poc-0001 v1]# cat Dockerfile
FROM adoptopenjdk/openjdk11:latest
RUN mkdir /opt/app
COPY leon-app-v1.jar /opt/app
CMD ["java", "-jar", "/opt/app/leon-app-v1.jar","--debug"]
Step 2:
[root@erp-poc-0001 v1]# docker build -t leonyan/myapp-v1 .
Sending build context to Docker daemon 17.06MB
Step 1/4 : FROM adoptopenjdk/openjdk11:latest
---> c537c6b0cca2
Step 2/4 : RUN mkdir /opt/app
---> Running in e346fd563655
Removing intermediate container e346fd563655
---> 0a3e3d8a9841
Step 3/4 : COPY leon-app-v1.jar /opt/app
---> b45a8be10d19
Step 4/4 : CMD ["java", "-jar", "/opt/app/leon-app-v1.jar","--debug"]
---> Running in c65eff109f56
Removing intermediate container c65eff109f56
---> 8c61a140cf3b
Successfully built 8c61a140cf3b
Successfully tagged leonyan/myapp-v1:latest
[root@erp-poc-0001 v1]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
leonyan/myapp-v1 latest 8c61a140cf3b 11 seconds ago 454MB
step 3:
[root@erp-poc-0001 v1]# docker push leonyan/myapp-v1
Using default tag: latest
The push refers to repository [docker.io/leonyan/myapp-v1]
742747eb603e: Pushed
4af27e0f87d4: Pushed
b72c39450167: Mounted from adoptopenjdk/openjdk11
9fc8766c7e74: Mounted from adoptopenjdk/openjdk11
2f140462f3bc: Mounted from adoptopenjdk/openjdk11
63c99163f472: Mounted from adoptopenjdk/openjdk11
ccdbb80308cc: Mounted from adoptopenjdk/openjdk11
最后
以上就是懦弱背包为你收集整理的打包jar 包到镜像仓库的全部内容,希望文章能够帮你解决打包jar 包到镜像仓库所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复