Reputation: 11512
I have a Docker container that contains a JVM process. When the process ends the container completes and stops.
While thankfully rare, my JVM can go legs-up suddenly with a hard-failure, e.g. OutOfMemoryError
. When this happens my container just stops, like a normal JVM exit.
I can have distributed logging, etc., for normal JVM logging, but in this hard-fail case I want to know the JVM's dying words, which are typically uttered on stderr.
Is there a way to know why my container stopped, look around in logs, stderr, or something along these lines?
Upvotes: 47
Views: 37583
Reputation: 14085
You can run the docker logs [ContainerName]
or docker logs [ContainerID]
command even on stopped containers. You can see them with docker ps -a
.
Source: the comment of Usman Ismail above: this is just a way to convert his comment into a proper answer.
Upvotes: 61