2019-12-15 11:47:28 +01:00
|
|
|
# docker logs
|
|
|
|
|
|
|
|
> Print container logs.
|
2024-09-24 22:39:51 -07:00
|
|
|
> More information: <https://docs.docker.com/reference/cli/docker/container/logs/>.
|
2019-12-15 11:47:28 +01:00
|
|
|
|
|
|
|
- Print logs from a container:
|
|
|
|
|
|
|
|
`docker logs {{container_name}}`
|
|
|
|
|
|
|
|
- Print logs and follow them:
|
|
|
|
|
2025-03-17 12:09:59 +02:00
|
|
|
`docker logs {{[-f|--follow]}} {{container_name}}`
|
2019-12-15 11:47:28 +01:00
|
|
|
|
|
|
|
- Print last 5 lines:
|
|
|
|
|
2025-03-17 12:09:59 +02:00
|
|
|
`docker logs {{container_name}} {{[-n|--tail]}} {{5}}`
|
2019-12-15 11:47:28 +01:00
|
|
|
|
|
|
|
- Print logs and append them with timestamps:
|
|
|
|
|
2025-03-17 12:09:59 +02:00
|
|
|
`docker logs {{[-t|--timestamps]}} {{container_name}}`
|
2019-12-15 11:47:28 +01:00
|
|
|
|
|
|
|
- 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}}`
|