Docker Community Forums

Share and learn in the Docker community.

Tomcat will not run when setting an ENTRYPOINT in Dockerfile


(Robban) #1
  • Problem
  • Mac
  • 1.12.6
  • Trying to run the following Dockerfile

Hi! I am struggling a bit with containers and entrypoint. I am trying to add an entrypoint to a standard tomcatcontainer. When I do, tomcat never starts. This is the Dockerfile
FROM tomcat:8.5.9-jre8
MAINTAINER Robert Myhren myhren@gmail.com

ENV MYSQL_URL jdbc:mysql://localhost/xwiki?useSSL=false
ENV MYSQL_USER xwiki
ENV MYSQL_PASS xwiki

RUN rm -rf webapps/* &&
curl -L
http://download.forge.ow2.org/xwiki/xwiki-enterprise-web-8.4.4.war
-o xwiki.war &&
unzip -d webapps/ROOT xwiki.war &&
rm -f xwiki.war

RUN curl -L
http://central.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/1.5.4/mariadb-java-client-1.5.4.jar
-o ‘webapps/ROOT/WEB-INF/lib/mariadb-java-client-1.5.4.jar’

COPY setenv.sh bin/
COPY catalina.policy conf/catalina.policy

EXPOSE 8080

VOLUME ["/usr/local/tomcat/webapps/ROOT/WEB-INF", “/var/local/xwiki”]

COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT [“docker-entrypoint.sh”]

, and this is the entrypoint file
#!/bin/bash

sed -ie ‘s_.environment.permanentDirectory.environment.permanentDirectory=/var/local/xwiki’ webapps/ROOT/WEB-INF/xwiki.properties
sed -ie “s_.connection.url.${MYSQL_URL}” webapps/ROOT/WEB-INF/hibernate.cfg.xml
sed -ie “s_.connection.username.${MYSQL_USER}” webapps/ROOT/WEB-INF/hibernate.cfg.xml
sed -ie “s_.connection.password.${MYSQL_PASS}” webapps/ROOT/WEB-INF/hibernate.cfg.xml

exec “$@”


(Bdabburi3091) #2

I am also facing same issue (Tomcat will not run when setting an ENTRYPOINT in Dockerfile). Any help appreciate on this.


(Ianbr) #3

Can you show your entrypoint.sh
We have tomcat running in containers without any problems.
In the previous persons entrypoint.sh I could not see where tomcat was actually started.

So for example in my entrypoint.sh the last line is:
$CATALINA_HOME/bin/catalina.sh run