In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
Most people do not understand the knowledge points of this article "SpringBoot packaging docker image release method", so the editor summarizes the following, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "SpringBoot packaging docker image release method" article.
1: first build a SpringBoot project
You just need to add web dependencies
2: write a controller for testing
3: start this machine to see if you can access it successfully.
4: pack
5: find the location of the generated jar package
Start-up test of the 6:jar package
7: write Dockerfile files
8: upload our jar package and Dockerfile files to the server
9: use the uploaded file to build an image [root@iZwz9hv1phm24s3jicy8x1Z idea] # lsDockerfile Docker-Package-0.0.1-SNAPSHOT.jar [root@iZwz9hv1phm24s3jicy8x1Z idea] # docker build-t dongmu-springboot-project .Sending build context to Docker daemon 17.54MBStep 1Accord 5: FROM java:88: Pulling from library/java5040bd298390: Pull complete fce5728aad85: Pull complete 76610ec20bf5: Pull complete 60170fec2151: Pull complete e98f73de8f0d: Pull complete 11f7af24ed9c: Pull complete 49e2d6393f32: Pull complete bb9cdec9c7f3: Pull complete Digest: sha256:c1ff613e8ba25833d2e1940da0940c3824f03f802c449f3d1815a66b7f8c0e9dStatus: Downloaded newer image for java:8-- -> d23bdf5b1b1bStep 2EXPOSE 5: COPY / *. Jar / app.jar-- > a16d648390dfStep 3 server.port=8080 5: CMD ["--server.port=8080"]-- > Running in bc45f72484c7Removing intermediate container bc45f72484c7-- > 713861b331adStep 4 Running in bc45f72484c7Removing intermediate container bc45f72484c7 5: EXPOSE 8080-- > Running in 7a28e4939b5eRemoving intermediate container 7a28e4939b5e-- > 08f540832166Step 5EXPOSE 5: ENTRYPOINT ["java" "- jar" "/ app.jar"]-- > Running in 6cd669cd522cRemoving intermediate container 6cd669cd522c-- > 1fd9f50df534Successfully built 1fd9f50df534Successfully tagged dongmu-springboot-project:latest10: use image to run container [root@iZwz9hv1phm24s3jicy8x1Z idea] # docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEdongmu-springboot-project latest 1fd9f50df534 About a minute ago 661MBredis 5.0.9-alpine3.11 3661c84ee9d0 24 months ago 29.8MBtomcat 9.0.22 c856951ade0a 2 years ago 624MBjava 8 d23bdf5b1b1b 5 years ago 643MB [root@iZwz9hv1phm24s3jicy8x1Z idea] # docker run-d-P-- name dongmu-springboot-web dongmu-springboot-projectc63282034de4e9dca727c93009e29f421bcd2544557a60b6339fa8056cc1d0d511: test access [root@iZwz9hv1phm24s3jicy8x1Z idea] # docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESc63282034de4 dongmu-springboot-project "java-jar / app.jar..." 34 seconds ago Up 33 seconds 0.0.0.0 8080/tcp 49166-> 8080/tcp,:: 49166-> 8080/tcp dongmu-springboot-web [root@iZwz9hv1phm24s3jicy8x1Z idea] # curl localhost 49166 Apache Tomcat/9.0.50. Access successful
Above is the internal access, let's restart the access using the external network.
[root@iZwz9hv1phm24s3jicy8x1Z idea] # docker run-d-p 3344Mun8080-- name dongmu-springboot-web dongmu-springboot-project35f3b4fe0f9a4b878d6566a9f4334fc98e7841b1fc5eb7869dd0044d4fb44d6d
The above is the content of this article on "SpringBoot packaging docker image release method". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.
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.