0
這是事情。我有以下Dockerfile:Tomcat在啓動時在Docker容器中凍結
DOCKERFILE
FROM centos:centos7
MAINTAINER Legos
ADD epel-release-7-9.noarch.rpm /etc/extras/epel-release-7-9.noarch.rpm
RUN rpm -Uvh /etc/extras/epel-release*rpm
# Install prepare infrastructure
RUN yum -y update && \
yum -y install wget && \
yum -y install tar && \
yum -y install haveged && \
yum -y install rng-tools
RUN chkconfig haveged on
# Prepare environment
ADD jdk* /opt/
WORKDIR /opt/
RUN yum localinstall -y "jdk-8u131-linux-x64.rpm"
RUN echo "1"|alternatives --config java
ENV JAVA_HOME /usr/java/jdk1.8.0_131
#ENV JAVA_OPTS "-Djava.security.egd=/dev/./urandom"
ENV CATALINA_HOME /opt/tomcat
ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin:$CATALINA_HOME/scripts
# Install Tomcat
ENV TOMCAT_MAJOR 8
ENV TOMCAT_VERSION 8.5.15
RUN wget http://www-eu.apache.org/dist/tomcat/tomcat-${TOMCAT_MAJOR}/v${TOMCAT_VERSION}/bin/apache-tomcat-${TOMCAT_VERSION}.tar.gz && \
tar -xvf apache-tomcat-${TOMCAT_VERSION}.tar.gz && \
rm apache-tomcat*.tar.gz && \
mv apache-tomcat* ${CATALINA_HOME}
RUN chmod +x ${CATALINA_HOME}/bin/*sh
# Create Tomcat admin user
ADD create_admin_user.sh $CATALINA_HOME/scripts/create_admin_user.sh
ADD tomcat.sh $CATALINA_HOME/scripts/tomcat.sh
ADD webapps/gireUsuarios.war $CATALINA_HOME/webapps/gireUsuarios.war
ADD conf/tomcat-users.xml $CATALINA_HOME/conf/tomcat-users.xml
ADD conf/Catalina/localhost/manager.xml $CATALINA_HOME/conf/Catalina/localhost/manager.xml
RUN chmod +x $CATALINA_HOME/scripts/*.sh
# Create tomcat user
RUN groupadd -r tomcat && \
useradd -g tomcat -d ${CATALINA_HOME} -s /sbin/nologin -c "Tomcat user" tomcat && \
chown -R tomcat:tomcat ${CATALINA_HOME}
WORKDIR /opt/tomcat
EXPOSE 8080 8009 8443 9100-9120 4369 80
RUN yum clean all
USER tomcat
CMD ["tomcat.sh"]
TL; DR:這是一個形象的CentOS的7機器的Tomcat 8.5和Java 1.8。在配置中創建用戶後,'tomcat.sh'只運行catalina.sh,所以沒有太多可以說的。
事情是這樣的:當我創建一個容器時,容器在部署我傳遞的.war文件時凍結。我試着啓動其他的.war文件,並獲得了積極的結果,我嘗試在我的機器Tomcat 8.5中部署這個有問題的.war文件(一個直接使用的Tomcat,只是增加了manager-gui用戶),並且它正在成功部署。
所以,問題:任何想法爲什麼Tomcat會在部署在Docker容器中時凍結?我嘗試了一下JAVA_OPTS = -Djava.security.egd =/dev/./ urandom解決方案,它可以幫助解決這類事情,但它並不奏效。建議?