We are deploying a Spring Boot application in a docker container on Ubuntu 20.x. Along with it are containers running Postgres, Caddy, and Watchtower, all started with Docker Compose.
These are deployed on Digital Ocean droplets with 1GB of RAM. This is how we spin up Spring Boot:
ENTRYPOINT ["java", "-Xmx896m", "-jar", "build.jar"]
Every now and then, our Spring Boot container restarts without warning or explanation. We are logging memory, disk space, CPU, thread count, all the vitals that we can think of. There is no sign of a problem in the JVM that we have been able to recognize. There is also no indication of a problem in the other containers.
We have begun to suspect either Docker or Linux is forcing the container to restart, but we don't know where to look for a log that identifies the perpetrator or the reason why it happened. This is primarily due to a lack of deep knowledge of Docker or Linux. We know enough, apparently, to be dangerous.
It is likely that this has to do with the sizing of our Docker container with respect to the JVM it contains, but without any explanation for the unexplained shutdowns, it is all conjecture. How can we determine what is actually happening?