Because springboot has a built-in tomcat server, it can be run directly after being packaged into a jar package. First, let's look at the packaging deployment in the Windows environment 1. Install and package 2. Check whether the project jar package exists in the target directory 3. If the project jar package already exists, you can run it directly (as mentioned earlier, the springboot package can be run directly) 4. Use the java -jar springboot-nriat-common-demo-0.0.1-SNAPSHOT.jar Startup effect: No error, startup successful! The above is about the springboot package deployment on the windows system. Let's get to the point. Use docker to deploy packages in linux system. 1. First, you need to prepare a dockerfile file, the content of the file is as follows: # Specify the base image FROM java:8 # Maintainer information MAINTAINER lbl # Define anonymous volume VOLUME /tmp #Copy the file or change the name ADD springboot-nriat-common-demo-0.0.1-SNAPSHOT.jar app.jar # Allow the specified port EXPOSE 8087 ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] File parsing Explain this configuration file: VOLUME specifies the temporary file directory as /tmp. The effect is that a temporary file is created in the host's /var/lib/docker directory and linked to the container's /tmp. This step is optional, but necessary if the application involves a file system. The /tmp directory is used to persist to the Docker data folder, because the embedded Tomcat container used by Spring Boot uses /tmp as the working directory by default. The project's jar file is added to the container as "app.jar" If it is the first time to package, it will automatically download the Java 8 image as the base image, and will not download it again when making images in the future. 2. Put the dockerfile file and the jar package of the springboot project in the same folder 3. Then start making the image docker build -t springboot-docker . Use docker images 5. Configure the springboot project and start the container docker run -d -p 8087:8087 8493c1f0592c
6. Finally, use docker ps -a Startup successful! ! This is the end of this article about using docker to deploy springboot packages in a linux environment. For more information about docker deploying springboot packages, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: CSS3 changes the browser scroll bar style
>>: Vue imports Echarts to realize line scatter chart
Environment: CentOS 7.1.1503 Minimum Installation...
Table of contents background: Nginx smooth upgrad...
Understanding of polling In fact, the focus of po...
Table of contents Preface 1. Install Docker 2. In...
The following error is reported when MySQL joins ...
This article example shares the specific code of ...
Table of contents 1. Differences and characterist...
1. Check the software installation path: There is...
During the development process, we often use the ...
Table of contents 1. Joint index description 2. C...
Recently, the company has begun to evaluate all s...
1: Download MySql Official website download addre...
Flappy Bird is a very simple little game that eve...
Table of contents Preface Browser compiled versio...
Process 1: with return value: drop procedure if e...