[root@master ~]# tree javaweb/
javaweb/
├── Dockerfile
└── files
└── halo-1.4.16.jar
制作镜像
[root@master javaweb]# vim Dockerfile
FROM openjdk:18-jdk-alpine
COPY files/halo-1.4.16.jar /usr/local/halo-1.4.16.jar
ENTRYPOINT ["java","-jar","/usr/local/halo-1.4.16.jar"]
[root@master javaweb]# docker build -t harry1004/halo:1.0 .
Sending build context to Docker daemon 79.63MB
Step 1/3 : FROM openjdk:18-jdk-alpine
18-jdk-alpine: Pulling from library/openjdk
59bf1c3509f3: Pull complete
20ae5de21b22: Pull complete
3048de22201a: Pull complete
Digest: sha256:e5c5b35b831a4f655074a25604130ce53e33567b82c8a7204f0e5641b66d477e
Status: Downloaded newer image for openjdk:18-jdk-alpine
---> c89120dcca4c
Step 2/3 : COPY files/halo-1.4.16.jar /usr/local/halo-1.4.16.jar
---> 2134d5f8cacf
Step 3/3 : ENTRYPOINT ["java","-jar","/usr/local/halo-1.4.16.jar"]
---> Running in c173a74eee