编写dockerfile
FROM centos
COPY ./metrics8080.jar /app/
RUN yum -y install java-1.8.0-openjdk.x86_64 \
&& yum -y install java-1.8.0-openjdk-headless.x86_64 \
&& yum -y install javapackages-tools.noarch
CMD java -jar /app/metrics8080.jar
编译运行
docker build -t jar-test:v1 .
docker run -p 8080:8080 jar-test:v1
网友评论