Reputation: 21
Where the docker container console logs are stored. And how can I have the console logs of docker container stored on my host?
I tried below to get the log location. This pointed me to file at /var/lib/docker/containers/
But I dont find any directory called as docker at /var/lib inside the docker container
docker inspect --format='{{.LogPath}}' <container id>
I want to collect the logs which we get from docker logs <containerid>
to have/mount it to my host.
Upvotes: 1
Views: 1357
Reputation: 1725
docker logs <CONTAINER_NAME> or <CONTAINER_ID>
like:
docker logs container1
The container should be started and running. Very useful to see what happens behind the container execution in context and methods and ...
hope it helped.
Upvotes: 0
Reputation: 3712
Try:
docker ps
to find CONTAINER ID
and
docker inspect <CONTAINER ID>| grep LogPath
to find logs, but a better approach is to use directly:
docker logs <CONTAINER ID>
Upvotes: 1