0

I am trying to build and run container where I can start tomcat ( I know I can find direct image but wanted to do by my own for learning )

When I am running it, it's getting down automatically,

I checked log, it says Tomcat started

docker build -t hanuman .

docker run -i -t  -p 80:8080  hanuman 

docker run -i -t  -p 80:8080  hanuman --entrypoint /bin/sh tail -f /dev/null

My Docker file

FROM ubuntu:16.04

RUN apt-get update

RUN apt-get install -y openjdk-8-jdk

ADD tomcat8 /usr/local/tomcat8

RUN cd home

RUN ls -lrt

RUN chmod 777 -R /usr/local/tomcat*

EXPOSE 8080 8009 443

ENTRYPOINT  ./usr/local/tomcat8/bin/catalina.sh start
Bukharov Sergey
  • 9,767
  • 5
  • 39
  • 54
Arvind
  • 1,207
  • 6
  • 27
  • 55
  • why are you tailing `/dev/null`? – Skam Feb 22 '18 at 16:13
  • without tail also it dosent work, somewhere I red that since there nothing to do container shunting down, and suggested there to do so https://stackoverflow.com/questions/30209776/docker-container-will-automatically-stop-after-docker-run-d – Arvind Feb 22 '18 at 16:15

1 Answers1

2

You want to use catalina.sh run such that the process does not terminate. start would start tomcat in background and then terminate.

ENTRYPOINT  ./usr/local/tomcat8/bin/catalina.sh run
Henry
  • 42,982
  • 7
  • 68
  • 84