Search code examples
javatomcatdockertomcat6libreplan

Docker image builds, but doesn't run


I am trying to create a docker build for libreplan, using the install instructions here. The dockerfile is

FROM tomcat:6

RUN apt-get -yq update && apt-get -yq install \
  cutycapt \
  patch \
  postgresql-client \
  libpg-java \
  xvfb

# Prepare webapp location
RUN mkdir -p /usr/local/tomcat/webapps/libreplan
# Get WAR file
RUN wget -q -O /usr/local/tomcat/webapps/libreplan/libreplan.war http://downloads.sourceforge.net/project/libreplan/LibrePlan/libreplan_1.3.0.war
# Install libreplan.xml
ADD libreplan.xml /usr/local/tomcat/webapps/libreplan/libreplan.xml
# Patch the policy to include libreplan
ADD catalina.policy.patch catalina.policy.patch
RUN patch -o /usr/local/tomcat/conf/catalina.policy /usr/local/tomcat/conf/catalina.policy catalina.policy.patch

CMD ["catalina.sh", "run"]

The build works but doesn't do anything when I try to run it. All the code is on github and I have set up an automated build on the docker registry. Included in the repo is a sample docker-compose.yml which should work, but when I try it no output is shown from the libreplan container and I can't access it through a browser. I don't know tomcat at all so it is probably something that I have done wrong, but I don't know how to even start figuring out what. Is there anything obvious that I have missed?


Solution

  • If I run your image:

    $ docker run --name libreplan aquavitae/libreplan
    

    I get:

    May 28, 2015 4:57:42 PM org.apache.catalina.core.AprLifecycleListener init
    INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
    May 28, 2015 4:57:42 PM org.apache.coyote.http11.Http11Protocol init
    INFO: Initializing Coyote HTTP/1.1 on http-8080
    May 28, 2015 4:57:42 PM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 387 ms
    May 28, 2015 4:57:42 PM org.apache.catalina.core.StandardService start
    INFO: Starting service Catalina
    May 28, 2015 4:57:42 PM org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/6.0.44
    May 28, 2015 4:57:42 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory host-manager
    May 28, 2015 4:57:42 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory manager
    May 28, 2015 4:57:42 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory examples
    May 28, 2015 4:57:42 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory libreplan
    May 28, 2015 4:57:42 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory ROOT
    May 28, 2015 4:57:42 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory docs
    May 28, 2015 4:57:42 PM org.apache.coyote.http11.Http11Protocol start
    INFO: Starting Coyote HTTP/1.1 on http-8080
    May 28, 2015 4:57:42 PM org.apache.jk.common.ChannelSocket init
    INFO: JK: ajp13 listening on /0.0.0.0:8009
    May 28, 2015 4:57:42 PM org.apache.jk.server.JkMain start
    INFO: Jk running ID=0 time=0/12  config=null
    May 28, 2015 4:57:42 PM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 580 ms
    

    Which seems entirely successful. Furthermore, I can grab the ip address of the container:

    $ docker inspect --format '{{ .NetworkSettings.IPAddress }}' libreplan
    172.17.0.9
    

    And the open that in a browser:

    $ firefox http://172.17.0.9:8080
    

    And see the default Tomcat web page.

    So mostly it seems to work.

    I can also docker up things without error, although I replaced the build: . line with image: aquavitae/libreplan because I wasn't patient enough to try the build.