# 加入java
FROM bitnami/java
# WORKDIR /usr/local/test/boot-work
#镜像内的工作目录
WORKDIR /usr/local/test
# ENV workPath = /usr/local/test/boot-work
# 宿主的当前目录 boot-v1.jarjar 拷贝到 WORKDIR下boot.jar
ADD boot-v1.jar boot.jar
# 暴露80端口
EXPOSE 80
# 启动命令
ENTRYPOINT ["nohup","java","-jar","boot.jar","&"]
[root@VM-12-15-centos boot]# ll
total 16452
-rw-r–r-- 1 root root 5316 Aug 5 14:07 boot.iml
-rw-r–r-- 1 root root 16825028 Aug 5 15:45 boot-v1.jar
-rw-r–r-- 1 root root 234 Aug 5 16:41 Dockerfile
-rw-r–r-- 1 root root 1087 Aug 5 14:07 pom.xml
drwxr-xr-x 3 root root 4096 Aug 5 14:07 src
[root@VM-12-15-centos boot]#
执行命令 构建
docker build .
运行docker镜像
docker run --name=b1 -dp 80:80 ca586b8faec7