In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of "principle Analysis of docker in springboot". The editor shows you the operation process through actual cases. The operation method is simple, fast and practical. I hope this article "principle Analysis of docker in springboot" can help you solve the problem.
1. Add maven configuration
Ms4t eureka org.springframework.boot spring-boot-maven-plugin com.spotify dockerfile-maven-plugin 1.3.6 ${docker.image.prefix} / ${project.artifactId} target/$ {project.build.finalName} .jar
Second, create a Dockerfile
FROM openjdk:8-jdk-alpineVOLUME / tmpARG JAR_FILECOPY ${JAR_FILE} app.jarENTRYPOINT ["java", "- jar", "/ app.jar"]
Parameter explanation:
FROM: a basic image is required, which can be public or private.
Subsequent builds will be based on this image. If multiple images are established in the same Dockerfile, multiple FROM instructions can be used.
VOLUME configures a directory with persistence, and a temporary file is created in the host / var/lib/docker directory and linked to the container's / tmp. The modification steps are optional, which is necessary if the application of the file system is involved.
. 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
ARG sets the parameters added when compiling the image. ENV is the environment variable that sets the container.
COPY: only local files can be copied to the container, and ADD is more powerful but more complex.
Commands executed when the ENTRYPOINT container starts
Mirror ports exposed by EXPOSE 8080
III. Construction
Mvn install dockerfile:build
IV. Start
Docker run-d-name name-p external port: container port image ID on "principle analysis of docker in springboot" is introduced here, thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
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.