docker容器下tomcat 不向catalina.out输出日志解决以及支持中文字符集
docker容器下tomcat 不向catalina.out输出日志解决
去掉 & 符号,直接 使用 ENTRYPOINT ["/data/tomcat/bin/startup.sh"]
Dockerfile文件如下:
FROM centos MAINTAINER fengjian <fengjian@senyint.com> ENV TZ "Asia/Shanghai" ENV TERM xterm ENV JAVA_HOME /data/jdk ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar ENV CATALINA_HOME /data/tomcat ENV CATALINA_BASE /data/tomcat ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/lib:$CATALINA_HOME/bin RUN rm /etc/yum.repos.d/* -rf ADD Centos-7.repo /etc/yum.repos.d/ ADD epel-7.repo /etc/yum.repos.d/ RUN yum clean all RUN yum -y install unzip net-tools bind-utils sysstat kde-l10n-Chinese telnet reinstall glibc-common RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8 ENV LC_ALL "zh_CN.UTF-8" ADD localtime /etc/ ADD jdk.tar.gz /data ADD tomcat.tar.gz /data ADD profile /etc ADD 20-nproc.conf /etc/security/limits.d/ ADD limits.conf /etc/security/ RUN mkdir -p /data/webserver EXPOSE 80
CMD ["/data/tomcat/bin/catalina.sh","run"]
20-nproc.conf
# Default limit for number of user's processes to prevent # accidental fork bombs. # See rhbz #432903 for reasoning. * soft nproc unlimited root soft nproc unlimited
cat limits.conf
# End of file * soft core 0 * hard core 0 * soft nofile 655360 * hard nofile 655360
cat profile
export JAVA_HOME=/data/jdk export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$JAVA_HOME:$PATH ulimit -u unlimited ulimit -s unlimited ulimit -i 514855 ulimit -SHn 655350
localtime 为中文时区。
制作基础镜像
docker build -t tomcat_jdk_1.8_2018.03.17 .
制作项目镜像:
FROM tomcat_jdk_1.8_2018.03.17 #维护者 MAINTAINER fengjian <fengjian@senyint.com> #设置一个时区的环境变量 ENV TZ "Asia/Shanghai" #虚拟终端 ENV TERM xterm ENV JAVA_HOME /data/jdk ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar ENV CATALINA_HOME /data/tomcat ENV CATALINA_BASE /data/tomcat ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/lib:$CATALINA_HOME/bin ADD admin-2.4.1.war /data/webserver/ RUN cd /data/webserver/ RUN unzip /data/webserver/admin-2.4.1.war -d /data/webserver/ RUN rm /data/webserver/admin-2.4.1.war -rf
启动 项目镜像后,容器中的进程
容器中catalina.out 日志