Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker view the logs of failed / crashed container [duplicate]

I know you can check the logs of a running container with:

Command to list containers

docker container ls

Command to view the logs

docker logs [container-id]

Question:

Can you also check the logs of a failed container that is not listed, because the container failed?

like image 422
Bram Janssen Avatar asked Nov 02 '19 06:11

Bram Janssen


1 Answers

Answer:

Command to list all containers, including failed / crashed containers:

docker ps -a

Now you will be able to find the id / name of your failed container and run the following command to check it's logs:

docker logs [container-id]

like image 166
Bram Janssen Avatar answered Oct 19 '22 00:10

Bram Janssen