Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The java Container of Intermediate docker runs external springboot-jar (external) (79)

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

After learning docker for such a long time, I finally began to practice. It feels particularly good to use docker in all deployment methods. Let me share here that I deploy springboot's rich jar package.

Download java's mirror docker pull java:openjdk-8spring boot

The packaged rich jar is placed in the specified directory.

Execute the command to create the container

Internal path / opt/pj/business.jar, container path / usr/business.jar.

Execute jar java-jar / usr/business.jar

Expose port-p

Docker run-d-v / opt/pj/business.jar:/usr/business.jar-- name business java:openjdk-8-p 8888 java-jar / usr/business.jar stop stop container replacement / opt/pj/ jar start start container every time you upgrade

Description of Docker configuration parameters

Name is used for the name of the container. It can include a tag tags and a set of tag parameters. The tags in the name will be stripped before the tag is applied. Default is empty set (optional) dockfile is used to build mirrored Dockerfile files, default is project.file ('Dockerfile') and must be a file object (optional) files needs to include a list of files in the context of Docker (optional) buildArgs A Map collection whose keys are all String, will be set for the build command-- build-arg parameter (optional) labels-a Map collection with String keys, will be set for the build command-- label parameter Default is empty (optional) whether pull pulls the latest basic image before building. It defaults to false. (optional) whether noCache sets the-no-cache parameter during build time to build the image from scratch; the default is false.

Now you can build a Docker image using the following command (make sure that the Docker process in the current environment is started)

PS: in fact, it is relatively simple to sum up by yourself, and learn and use what you have learned.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report