If you want logs to be persistent when a container restarts (e.g., due to a container crash), they should be stored in a location outside Docker containers and mounted when running them. The location can be mounted by using the volume –v option when running a container (to learn more, see https://docs.docker.com/get-started/06_bind_mounts/). For example:

docker run -p 8080:8080 –v /var/logs/wap:/usr/local/tomcat/logs <image_name:version>


This command will mount the /var/logs/wap directory to the /user/local/logs directory of the container. In this example, logs will be saved in the /var/logs/wap directory of the host machine. The /usr/local/tomcat/logs directory is the location where logs are configured to be saved on the container. For example, it may be different if Windows Tomcat is used as the base image or if logging configuration points to a different location.