Use docker deployment springboot project demo

Reference blog: https://www.cnblogs.com/spll/p/10059542.html

1. first need to install linux docker environment;

2. Prepare a springboot project can run, ensure that no problem playing .jar package;

3. Prepare Dockerfile file, as follows (the reference blog is not content running up):

FROM java:8
VOLUME /tmp
ADD demo-0.0.1-SNAPSHOT.jar app.jar
RUN sh -c 'touch /app.jar'
ENV JAVA_OPTS=""
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ]

4. .jar packet and the linux Dockerfile the same folder, and then execute the command Mirror docker Construction:

# thymeleaf-master represents the name of the generated image, (note point behind.) 
Docker Build -t Demo.

6. The browser access

 

Guess you like

Origin www.cnblogs.com/yerikm/p/11231620.html