Deploying Spring Boot App in Docker container without auto starting Tomcat

6/12/2018

I was under the impression that including the line

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

to the Dockerfile would be what triggers the Tomcat server to start. I've removed that line but it still starts the server on deployment. I basically want to add the catalina.sh run and include CATALINA_OPTS all in a Kubernetes deployment to handle this stuff, but Tomcat still auto starts up when I deploy to a container.

-- Aeonstrife
docker
kubernetes
tomcat

1 Answer

6/13/2018

Docker image usually has an entry point or a command already.

If you create your custom image based on another image from a registry, which is a common case, you can override base image entry point by specifying the ENTRYPOINT or the CMD directive.

If you omit the entry point in your docker file, it will be inherited from the base image.

Consider reading Dockerfile: ENTRYPOINT vs CMD article to have a better understanding of how it works.

-- VAS
Source: StackOverflow