SamHuffman
SamHuffman

Reputation: 567

How can I get the logs of a crashed service

I'm using docker compose to up a service. It crashes (I guess since it is supposed to run a server).

I tried

docker compose -f [my_docker_compose_file] logs

but it doesn't say anything and shouldn't but I can't work around an other way to get the logs.

Question is, how do I retrieve the logs of the crashed service ?

Upvotes: 0

Views: 1388

Answers (1)

neonwatty
neonwatty

Reputation: 346

List out all containers on your machine

docker container ls -a

The -a flag here is important - to include all stopped (e.g., crashed) containers in addition to those still up and running.

Find the container representing your service from this list - suppose it is called <my-container>. To see the logs of this container

docker container logs <my-container>

Upvotes: 2

Related Questions