I have created Docker container and Tomcat is running in this container. How can I deploy a webapp or war file in Tomcat that is running in docker container.
First create a Dockerfile:
FROM library/tomcat
RUN rm -rf /usr/local/tomcat/webapps/*
ADD ./relative/path_to_war.war /usr/local/tomcat/webapps/ROOT.war
Then build Docker image
$ docker build -t user/image_name .
And finally run docker container.
$ docker run --name container_name -p 80:8080 -d user/image_name
After that your webapp should be responding on Docker host's ip on default http 80 port.
You might need to link a database container to your webapp, see more on Docker documentation
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