In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to package and deploy multiple jar packages in docker and start them. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.
1. Create a new Dockerfile
FROM java:8MAINTAINER lyjRUN ln-sf / usr/share/zoneinfo/Asia/Shanghai / etc/localtimeRUN echo 'Asia/Shanghai' > / etc/timezoneADD thedatamanager-authserver-0.0.1-SNAPSHOT.jar / authserver.jar#RUN chmod + x / authserver.jarADD start.sh / start.shRUN chmod + x / start.shENTRYPOINT ["sh", "- c", ". / start.sh"]
two。 Create a new start.sh
Add & after the #! / bin/bash# command to keep the background running nohup java-jar / authserver.jar-- server.port=8899 & nohup java-jar / authserver.jar-- server.port=8888 & # designated port java-jar / thedatamanager-authserver-0.0.1-SNAPSHOT.jar-- server.port=7104#nohup java-jar / root/lyjnginx/thedatamanager-authserver-0.0.1-SNAPSHOT.jar > authserver.log 2 > & 1 & # endless loop Keep the docker foreground running while [[true]] Do sleep 1done# may not use the following method in an endless loop: add & after the command to keep the program running in the background # nohup java-jar / app.war-- server.port=8085 & # java-jar / app.war-- server.port=8086
3. Packing
Docker build-t lyj2jar:v2.
4. Running
Docker run-d-p 8888 8888-p 8899 Swiss 8899-- name lyj2jartest1 lyj2jar:v2
5. Check the operation status
[root@ambari-01 lyjJars] # docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESe1f6a0cfe2a3 lyj2jar:v2 "sh-c. / start.sh" 5 minutes ago Up 5 minutes 0.0.0.0 minutes ago Up 8888-> 8888/tcp, 0.0.0.0 minutes ago Up 8899-> 8899/tcp lyj2jartest1
6. Commands used
Docker ps-a / / View all started containers
Docker rm container name / ID / / Delete container
Docker rmi name / ID / / Delete the image
Docker images / / View all mirrors
Docker stop containerID/ name / / stop container
Docker logs-- tail-f 804c083f5468 / / View log
Docker stats / / View container memory cpu usage
EXPOSE https://blog.csdn.net/u012972836/article/details/83380220 explained in detail by Docker
This is enough about how to package and deploy multiple jar packages in docker and start them. I hope the above content can be helpful to you and learn more. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.