提示:请先安装docker
文章目录
Dockerfile
FROM openjdk:8-jdk-alpine
VOLUME /tmp
ARG JAR_FILE
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
执行命令
$ docker build --build-arg JAR_FILE=target/*.jar -t myorg/myapp .
target/*.jar替换为spring boot 应用打包后的相对路径,如
docker build --build-arg JAR_FILE=webtest.jar -t hello:v1 .