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?

  • rabbitMQ nodedown error from Dockerfile
  • What is a correct/better way to use docker stack deploy with independently updated services?
  • How do you know that public Docker images are secure?
  • docker dnsmasq wildcard sub domains not supported?
  • How to take container snapshots in docker
  • Cannot receieve response from activemq when using docker
  • How to deploy a rails app to google container engine with kubernetes?
  • How to configuring Docker Containers with DHCP addresses local host?
  • CircleCI './docker-compose.yml' service 'version' doesn't have any configuration options
  • docker-maven-plugin: How to define which tests are run for which image?
  • How to store my docker registry in the file system
  • How to build dockerfile
  • 2 Solutions collect form web for “Docker image builds, but doesn't run”

    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.

    OK in this situation you have to troubleshoot by running a shell in the container and starting up the process manually. If you’re lucky docker logs containername may have enough information for you to understand what’s wrong, but usually I end up having to get into the container as follows:

    docker run --interactive --tty --link db:db <containerid> bash
    

    Once in, you,ll want to run your CMD directly.

    catalina.sh run
    

    Looking at your file, my first thought would be catalina.sh is not in your PATH or not executable. So you would fix that by running /bin/sh /full/path/to/catalina.sh run, or adjusting your PATH environment variable and/or using the WORKDIR directive in your Dockerfile.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.