需要解决的越来越多, 基础镜像中 添加 cronolog功能,用于切割catalina.out 日志。
思路是: cephfs 挂载在node节点, crontab 删除 几天的tomcaat 日志。 也想把crontab放在基础镜像中,出现服务无法启动
镜像 1G,太大了。
FROM centos MAINTAINER fengjian <fengjian@senyint.com> ENV TZ "Asia/Shanghai" ENV TERM xterm
ENV MALLOC_ARENA_MAX=1 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.repo /etc/yum.repos.d/ RUN yum clean all RUN yum -y install fontconfig ttmkfdir unzip net-tools bind-utils sysstat kde-l10n-Chinese telnet reinstall glibc-common gcc automake autoconf libtool make gcc-c++ RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8 ENV LC_ALL "zh_CN.UTF-8" ADD cronolog-1.6.2.tar.gz /root/ RUN cd /root/cronolog-1.6.2 && ./configure && make && make install && rm -rf /root/cronolog-1.6.2 && mkdir /usr/share/fonts/chinese -p ADD SIMHEI.TTF /usr/share/fonts/chinese ADD SIMSUN.TTC /usr/share/fonts/chinese RUN chmod -R 755 /usr/share/fonts/chinese && ttmkfdir -e /usr/share/X11/fonts/encodings/encodings.dir ADD fonts.conf /etc/fonts/fonts.conf 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 && mkdir -p /data/logs #EXPOSE 80 #ENTRYPOINT ["/data/tomcat/bin/startup.sh"] #ENTRYPOINT ["/data/tomcat/bin/catalina.sh","run"]
[root@harbor tomcat8_jdk1.8_noport_20180827]# cat profile # /etc/profile # System wide environment and startup programs, for login setup # Functions and aliases go in /etc/bashrc # It's NOT a good idea to change this file unless you know what you # are doing. It's much better to create a custom.sh shell script in # /etc/profile.d/ to make custom changes to your environment, as this # will prevent the need for merging in future updates. pathmunge () { case ":${PATH}:" in *:"$1":*) ;; *) if [ "$2" = "after" ] ; then PATH=$PATH:$1 else PATH=$1:$PATH fi esac } if [ -x /usr/bin/id ]; then if [ -z "$EUID" ]; then # ksh workaround EUID=`id -u` UID=`id -ru` fi USER="`id -un`" LOGNAME=$USER MAIL="/var/spool/mail/$USER" fi # Path manipulation if [ "$EUID" = "0" ]; then pathmunge /sbin pathmunge /usr/sbin pathmunge /usr/local/sbin else pathmunge /usr/local/sbin after pathmunge /usr/sbin after pathmunge /sbin after fi HOSTNAME=`/bin/hostname 2>/dev/null` HISTSIZE=1000 if [ "$HISTCONTROL" = "ignorespace" ] ; then export HISTCONTROL=ignoreboth else export HISTCONTROL=ignoredups fi 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 export MALLOC_ARENA_MAX=1 export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL MALLOC_ARENA_MAX # By default, we want umask to get set. This sets it for login shell # Current threshold for system reserved uid/gids is 200 # You could check uidgid reservation validity in # /usr/share/doc/setup-*/uidgid file if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then umask 002 else umask 022 fi for i in /etc/profile.d/*.sh ; do if [ -r "$i" ]; then if [ "${-#*i}" != "$-" ]; then . "$i" else . "$i" >/dev/null 2>&1 fi fi done unset i unset -f pathmunge ulimit -u unlimited ulimit -s unlimited ulimit -i 514855 ulimit -SH 655350 ulimit -n 1024000