I am using docker container/image here. After running the docker container, everything is OK. but if I run /usr/local/tomcat/bin# ./catalina.sh stop
or /usr/local/tomcat/bin# ./shutdown.sh
, the running docker container will stop and exit.
Why? How to change it?
Thanks. Any comment welcomed.
Why docker container is exited immediately? You're running a shell in a container, but you haven't assigned a terminal: If you're running a container with a shell (like bash ) as the default command, then the container will exit immediately if you haven't attached an interactive terminal.
The simplest way to keep the container running is to pass a command that never ends. We can use never-ending commands in any of the following ways: ENTRYPOINT or CMD directive in the Dockerfile. Overriding ENTRYPOINT or CMD in the docker run command.
Stop YouTrack docker container For a graceful shutdown, you can also use the standard ` docker kill --signal=SIGTERM <containerId> ` command.
docker rm -f The final option for stopping a running container is to use the --force or -f flag in conjunction with the docker rm command. Typically, docker rm is used to remove an already stopped container, but the use of the -f flag will cause it to first issue a SIGKILL.
This is by definition, see https://github.com/docker-library/tomcat/blob/master/Dockerfile.template in which the latest line is CMD ["catalina.sh", "run"]
Once you manually do catalina stop
you cause the above CMD to terminate, hence the container stops.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With