How to View and Follow Docker Container Logs in Real Time
Inspect stdout and stderr output from containers with timestamps, tail line limits, and live streaming.
docker logs -f --tail 100 <container-name>Step-by-Step Execution Guide
docker logs -f <container-name>Continuously outputs incoming log lines until you press Ctrl+C.
docker logs -f --tail 100 <container-name>Prevents terminal buffer flooding by displaying only the latest 100 entries before tailing.
docker logs -t --tail 50 <container-name>Prepends each log line with an ISO 8601 UTC timestamp.
docker logs --since 30m <container-name>Filters logs produced within the last 30 minutes (supports 10m, 2h, or ISO dates).
Critical Docker Pitfalls & Precautions
- β’Containers logging directly to internal files instead of stdout/stderr will not appear in "docker logs".
View & Stream Container Logs - Frequently Asked Questions
Common questions about container isolation, signal handling, and runtime behavior.
By default, on Linux: /var/lib/docker/containers/<id>/<id>-json.log. Configure log rotation in daemon.json (max-size, max-file) to avoid filling disk.
Related Docker Command Guides
Browse All Docker RecipesOpen an interactive terminal shell session inside a live running Docker container to inspect files, debug processes, or test network connectivity.
Reclaim gigabytes of hard drive space by removing stopped containers, unused networks, dangling images, and build caches.
Instantly stop all active containers and optionally remove them with a single command.
Copy files or directories between a Docker container and your local host file system without creating a volume mount.
Understand the fundamental differences between ENTRYPOINT and CMD directives and how to combine them for flexible container CLIs.
Best practices for copying files into Docker images. Why COPY is almost always preferred over ADD.