docker tomcat Log issue
If you look at the official tomcat docker image, it runs
CMD ["catalina.sh", "run"]
That is enough to starts tomcat in the foreground, displaying the logs on the console.
But, as you said, that might not populate catalina.out.
CMD service tomcat start && tail -f /var/lib/tomcat/logs/catalina.out
There are options in this (off topic) question to make the tomcat logs run in the foreground.
But to answer your actual question, the docker logs command is the usual way to get logs from a container. You can also find them on the host as they live in a file.
But the best way is to use an external logging service to collect and aggregate the logs, so you don't have to log in to the production server. Logentries is one example (though it's far from perfect). Splunk is another.The Docker logging drivers docs may help.
You need to have one process running in foreground in docker container to have the container running.
I use a hack with all my docker images.Create a script run.sh with the following code
#!/bin/shservice tomcat starttail -f /dev/null
Make sure before you run the run.sh file in docker, change the permissions.
Addition to Dockerfile will be
COPY run.sh ./run.shRUN chmod 755 ./run.shCMD ["./run.sh"]