1. 程式人生 > >用dockerfile構建基於centos系統的jar包的映象

用dockerfile構建基於centos系統的jar包的映象

實際示例:

[[email protected] home-dataline]# ls
dataline.jar  Dockerfile  jdk-8u181-linux-x64.tar.gz

  

[[email protected] home-dataline]# cat Dockerfile 

FROM centos
MAINTAINER weifeng "[email protected]******.cn"


ENV LANG en_US.UTF-8

RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone

WORKDIR /home

RUN mkdir JDK


COPY jdk-8u181-linux-x64.tar.gz /home/
COPY d*****ne.jar /home/


RUN tar zxf /home/jdk-8u181-linux-x64.tar.gz -C /home/JDK 


ENV JAVA_HOME /home/JDK/jdk1.8.0_181
ENV PATH $PATH:$JAVA_HOME/bin


EXPOSE 8080


ENTRYPOINT ["java","-jar","da****ne.jar"," -Xms512m","-Xmx2048m","--spring.profiles.active=dev","--server.port=8080"]

  

docker build -t dat****e-jar02 /home-dataline/

docker run -it --name da***e-jar02 -p 8080:8080 da***e-jar02 /bin/bash