Boris
Boris

Reputation: 1291

Accessing logs of a running docker container

How can I access the stdout & stderr of a running docker container?

When I inspect the container with docker inspect <id> | grep log I receive the following:

"LogPath": "/var/lib/docker/containers/<long id>-json.log"

But I can't find the file neither on my current folder, nor when trying to run docker exec <id> cat /var/lib/docker/containers/<long id>-json.log

edit running docker log <id> doesn’t give anything either


I am launching the container with the following command:

docker run -d -it --log-driver json-file --rm --log-opt max-size=10m --log-opt max-file=3 <my_app>

What am I missing/forgetting?

Upvotes: 0

Views: 386

Answers (1)

user4889345
user4889345

Reputation:

Try :

docker logs <container ID>

Upvotes: 1

Related Questions