These Dockerfile examples demonstrate two options for running a script at container startup, then running the main container process. The example script downloads index.html from https://example.com/ and writes it into Tomcat webapps directory. The index.html is then served by the container at http://localhost:8080/default-app/.
docker build . -t tomcat-with-startup
docker run --rm -it -p 8080:8080 tomcat-with-startupexec is the preferred option because the startup.sh shell script will be replaced by catalina.sh as the main container process. As the main process of the container, it can respond to signals sent to the container.