Home > Back-end >  How can I get the logs of a crashed service
How can I get the logs of a crashed service

Time:10-06

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 ?

CodePudding user response:

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>
  • Related