優化Docker映象大小方案
阿新 • • 發佈:2018-12-26
FROM ubuntu:16.04MAINTAINER chenyufeng "[email protected]"# 設定當前工具目錄# 該命令不會新增映象層WORKDIR /home# 安裝必要的工具RUN apt-get updateRUN apt-get install wget --assume-yes#RUN rpm --rebuilddbRUN apt-get install tar --assume-yesRUN wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz && \ tar -xvzf jdk-8u131-linux-x64.tar.gz && \ wget http://mirrors.shuosc.org/apache/tomcat/tomcat-8/v8.0.47/bin/apache-tomcat-8.0.47.tar.gz && \ tar -xvzf apache-tomcat-8.0.47.tar.gz && \ mv apache-tomcat-8.0.47/ tomcat && \ rm -f jdk-8u131-linux-x64.tar.gz && \ rm -f apache-tomcat-8.0.47.tar.gz# 設定環境變數ENV JAVA_HOME /home/jdk1.8.0_131ENV CATALINA_HOME /home/tomcatENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin# 暴露tomcat 8080埠EXPOSE 8080ENTRYPOINT /home/tomcat/bin/startup.sh && tail -f /home/tomcat/logs/catalina.out# 建立容器啟動tomcatCMD ["/home/tomcat/bin/startup.sh","run"]