Dockerfile builds springboot project deployment

1. Prepare springBoot executable items

2. Place the executable project in the directory where the Dockerfile of the server resides

3. Write Dockerfile

FROM openjdk:8
WORKDIR /ems
ADD ems.jar /ems
EXPOSE 8989
ENTRYPOINT ["java"."-jar"]
CMD ["ems.jar"]
Copy the code

4. Build an image

[root@localhost ems]# docker build -t ems. # ems: create an image using the Dockerfile of the current directoryCopy the code

5. Run the image

[root@localhost ems]# docker run -p 9001:8989 ems
Copy the code

6. Visit projects

http://10.15.0.8:8989/ems/login.html
Copy the code