docker logs --follow [container name]
docker logs -f --tail <N> <container_name>
/var/lib/docker/containers/<container_id>/<container_id>-json.log
docker logs [OPTIONS] CONTAINER
//EXAMPLE:
docker logs -f <container_id/container_name>
Name, shorthand Default Description
--details Show extra details provided to logs
--follow , -f Follow log output
--since Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)
--tail , -n all Number of lines to show from the end of the logs
--timestamps , -t Show timestamps
--until Show logs before a timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)
You find these JSON log files in the
/var/lib/docker/containers/
directory on a Linux Docker host.
docker inspect --format='{{.LogPath}}' <containerId>
Amazon Linux: /var/log/docker.
CentOS/RHEL: /var/log/messages | grep docker.
macOS: ~/Library/Containers/com. docker. docker/Data/log/vm/dockerd. log.
Windows: AppDataRoamingDockerlogvmdockerd. log.
docker logs [OPTIONS] CONTAINER
docker run --name test -d busybox sh -c "while true; do $(echo date); sleep 1; done"
$ date
Tue 14 Nov 2017 16:40:00 CET
$ docker logs -f --until=2s test
Tue 14 Nov 2017 16:40:00 CET
Tue 14 Nov 2017 16:40:01 CET
Tue 14 Nov 2017 16:40:02 CET