Springboot project packaging Docker image

Springboot project packaging Docker image

IDEA installs Docker
Insert picture description here
, creates a Dockerfile in the project directory,
Insert picture description here
edits the Dockerfile

FROM java:8

COPY *.jar /app.jar

CMD ["--server.port=8080"]

EXPOSE 8080

ENTRYPOINT ["java","-jar","/app.jar"]

Insert picture description here
Upload the jar package and Dockerfile to the server.
Insert picture description here
Enter the server to store the uploaded files and generate a mirror image

docker build -t springtoot

Start the container

 docker run  -d -P  --name springboot01 springtoot

Test container

curl localhost:49161

Guess you like

Origin blog.csdn.net/weixin_45742032/article/details/111638293