1、先准备好你的springboot项目jar包。拉取 openjdk
docker pull openjdk:8-jdk-alpine
2、上传你的springboot项目,然后配置 Dockerfile:
FROM openjdk:8-jdk-alpine
ADD ./springbootstudy.jar.jar /app.jar
ENTRYPOINT ["java","-jar","app.jar"]
3、build 容器,报错,注意结尾加空格 .
否则报错:“docker build“ requires exactly 1 argument(s).
docker build -f Dockerfile -t XXX .
4、制作成springboot-jar以后,运行springboot-jar:
docker run -p 8082:8082 -d springboot-jar
5、在系统访问:
172.19.211.109:8082/springbootstudy/hello