LinuxCommandLibrary

docker-logs

Print container logs.

TLDR

Print logs from a container

$ docker logs [container_name]
copy


Print logs and follow them
$ docker logs -f [container_name]
copy


Print last 5 lines
$ docker logs [container_name] --tail [5]
copy


Print logs and append them with timestamps
$ docker logs -t [container_name]
copy


Print logs from a certain point in time of container execution (i.e. 23m, 10s, 2013-01-02T13:23:37)
$ docker logs [container_name] --until [time]
copy

SYNOPSIS

docker logs [OPTIONS] CONTAINER

DESCRIPTION

Alias for docker container logs.

OPTIONS

--details[=false] Show extra details provided to logs

-f, --follow[=false] Follow log output

-h, --help[=false] help for logs

--since="" Show logs since timestamp (e.g. "2013-01-02T13:23:37Z") or relative (e.g. "42m" for 42 minutes)

-n, --tail="all" Number of lines to show from the end of the logs

-t, --timestamps[=false] Show timestamps

--until="" Show logs before a timestamp (e.g. "2013-01-02T13:23:37Z") or relative (e.g. "42m" for 42 minutes)

SEE ALSO

docker(1)

Copied to clipboard