Search code examples
tomcat7dockerubuntu-10.04

Tomcat not running on docker image


I installed tomcat7 on the image using Dockerfile through the command :

MAINTAINER Abc Xyz <abc@xyz.com>
RUN apt-get -qq update
RUN apt-get -y install openjdk-7-jre
RUN apt-get -y install tomcat7 
EXPOSE 8080

When I build the image and try to run the following command :

sudo docker run -d -P abcxyz/tomcat service tomcat7 start

I don't get to see the tomcat page on the port to which it is mapped (say 49153)... And when I run as a bash in the image and I try :

service tomcat7 start

Then also it fails to start the tomcat7 server. I think that the problem is that image is unable to start the tomcat7 server. And I heard that docker images can't run any upstart services though I am not sure.

Anybody has any idea how to solve it? Thanks.


Solution

  • It's not working, because the container will work for as long as the program you specified is running. The service tomcat7 start command finishes immediately.