参考:https://blog.csdn.net/liuxianwen1990/article/details/136256490
1,把jar包复制/opt/test, cd到这个目录下
2,创建Dockerfile文件,
jdk8版本
vim Dockerfile FROM openjdk:8-jre-alpine COPY demo-0.0.1-SNAPSHOT.jar demo-0.0.1-SNAPSHOT.jar CMD ["java", "-jar", "demo-0.0.1-SNAPSHOT.jar"]
jdk17版本
vim Dockerfile FROM openjdk:17-jdk WORKDIR /app COPY demo-0.0.1-SNAPSHOT.jar demo-0.0.1-SNAPSHOT.jar CMD ["java", "-jar", "demo-0.0.1-SNAPSHOT.jar"]
3,构建镜像
docker build -t app_demo:v1 .
4,启动容器
docker run -itd -p 8008:8008 --name app_demo app_demo:v1
标签:java,demo,app,jar,SNAPSHOT,0.0,镜像,docker From: https://www.cnblogs.com/lfxx/p/18096260