How to update war files in a docker tomcat container
My file for reference is :
FROM tomcat:7-jre7 MAINTAINER: me, firstname.lastname@example.org ADD app.war /usr/local/tomcat/webapps EXPOSE 8080 CMD ["catalina.sh", "run"]
Now that thats all good I have two questions:
- In the event of something bad, can I ssh in and look at log files or something?
- How does one update the war file? Is there some way to ssh / scp a new file in?
So far I’ve tried starting the original image by doing:
docker run -t <_id> /bin/bash
and then doing an attach like below from a different session, but that didnt’r do much – all I saw was a black screen.
docker attach <running_container_id>
Another way (untested) I thought of was to share the file from the host – hopefully updating the war file will trigger tomcat to redeploy the war file? Has anyone attempted this?
Is there a nicer simpler way to do this?
Thanks for any input, appreciate it.
One Solution collect form web for “How to update war files in a docker tomcat container”
You have several options, depending on what you want to do. The easiest option is to simply have the folder for your built war file also contain the Dockerfile you have above. Then, whenever the war file is updated, kick off a docker build and docker run. This could be automated easily with fig as well, with something like:
tomcat: build: ./war
Now just run
fig up whenever the war file changes and your new container will get built from the Dockerfile in the
war folder and ran.