Docker Logging

Introduction to Docker logging and their usage

2 min read |263 words
March 12, 2026

View Container Logs

docker logs <container-name>

Example:

docker logs my-nginx

Follow Container Logs

docker logs -f <container-name>

Example:

docker logs -f my-nginx

Attributes of Docker Logs

View Logs with Timestamps

docker logs --timestamps <container-name>

Example:

docker logs --timestamps my-nginx

View Logs with Tail

docker logs --tail <number> <container-name>

Example:

docker logs --tail 100 my-nginx

View Logs with Since

docker logs --since <time> <container-name>

Example:

docker logs --since 2026-03-01T00:00:00 my-nginx
docker logs --since 10m my-nginx

Output:

2026-03-12T12:00:00.000000Z Start nginx...
2026-03-12T12:01:00.000000Z nginx is runn

View Logs with Until

docker logs --until <time> <container-name>

Example:

docker logs --until 2026-03-01T00:00:00 my-nginx
docker logs --until 10m my-nginx

Output:

2026-03-12T12:00:00.000000Z Start nginx...
2026-03-12T12:01:00.000000Z nginx is runn

View Logs with Multiple Attributes (Tail, Since, Until)

docker logs --tail <number> --since <time> --until <time> <container-name>

Example:

docker logs --tail 100 --since 2026-03-01T00:00:00 --until 2026-03-12T12:00:00 my-nginx
docker logs --tail 100 --since 10m --until 5m my-nginx

Output:

2026-03-12T12:00:00.000000Z Start nginx...
2026-03-12T12:01:00.000000Z nginx is runn

View Logs of All Containers

docker logs --all

Output:

2026-03-12T12:01:00.000000Z nginx is runn
2026-03-12T12:00:00.000000Z Start mysql...
2026-03-12T12:01:00.000000Z mysql is runn

View Logs of Multiple Containers

docker logs <container-name-1> <container-name-2> ...

Example:

docker logs my-nginx my-mysql

Output:

2026-03-12T12:00:00.000000Z Start nginx...
2026-03-12T12:01:00.000000Z nginx is runn
2026-03-12T12:00:00.000000Z Start mysql...
2026-03-12T12:01:00.000000Z mysql is runn

View Logs of Multiple Containers with Attributes

docker logs --tail <number> --since <time> --until <time> <container-name-1> <container-name-2> ...

Example:

docker logs --tail 100 --since 2026-03-01T00:00:00 --until 2026-03-12T12:00:00 my-nginx my-mysql

Output:

2026-03-12T12:00:00.000000Z Start nginx...
2026-03-12T12:01:00.000000Z nginx is runn
2026-03-12T12:00:00.000000Z Start mysql...
2026-03-12T12:01:00.000000Z mysql is runn