Docker Community Forums

Share and learn in the Docker community.

Tomcat fails to start when adding an entrypoint

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

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.*_<property name="connection.url">${MYSQL_URL}</property>_" webapps/ROOT/WEB-INF/hibernate.cfg.xml
sed -ie "s_.*connection.username.*_<property name="connection.username">${MYSQL_USER}</property>_" webapps/ROOT/WEB-INF/hibernate.cfg.xml
sed -ie "s_.*connection.password.*_<property name="connection.password">${MYSQL_PASS}</property>_" webapps/ROOT/WEB-INF/hibernate.cfg.xml

exec "$@"