LinuxCommandLibrary

docker-logs

fetch container logs from STDOUT and STDERR

TLDR

Show container logs

$ docker logs [container]
copy
Follow log output
$ docker logs -f [container]
copy
Show last N lines
$ docker logs --tail [100] [container]
copy
Show timestamps
$ docker logs -t [container]
copy
Show logs since time
$ docker logs --since [2h] [container]
copy
Show logs until time
$ docker logs --until [1h] [container]
copy

SYNOPSIS

docker logs [options] container

DESCRIPTION

docker logs fetches the logs of a container. Shows STDOUT and STDERR output from the container's main process. Logs are captured by Docker's logging driver and can be filtered by time range or number of lines. Essential for debugging containerized applications and monitoring runtime behavior.

PARAMETERS

-f, --follow

Follow log output.
--tail string
Number of lines from end (default "all").
-t, --timestamps
Show timestamps.
--since string
Show logs since timestamp or duration.
--until string
Show logs before timestamp or duration.
--details
Show extra details.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community