Show the log output (stdout/stderr) of the nginx1 container.
docker logs nginx1
Docker captures everything written to stdout/stderr. Use --follow (-f) for live streaming, --tail N for last N lines, --since for time-based filtering.
Safety: Inspect state before stopping, pruning, or changing running containers.
Show the last 50 lines of the nginx1 container logs.
docker logs --tail 50 nginx1
--tail 50 limits output to the last 50 lines. Combine with -f to follow tailing output, or --since 5m for time-windowed logs.
Safety: Inspect state before stopping, pruning, or changing running containers.
Follow the log output of nginx1 in real time.
docker logs -f nginx1
-f tails like tail -f, streaming new log lines as they're written. Ctrl-C to stop. Add --tail 50 to also show recent backlog.
Safety: Inspect state before stopping, pruning, or changing running containers.
Build the habit: DockerDrill drills docker logs and the rest of the Docker workflow until the safe first move is automatic. Try a Docker drill.