Back to commands

Web Server Rescue

Changes system state

Read Recent Container Logs

A container is failing and full logs are too large or too noisy.

Command

docker logs --since 10m --tail 100 api

Before you run this

System impact: Changes system or application state. Needs inspection, scoping, and rollback notes before production use.

When not to use it: Do not paste raw logs into public channels without reviewing them for secrets or user data.

Expected output

The last 100 log lines from the previous 10 minutes.

System impact

Changes system state. Nothing changes locally. Docker reads recent log output for one container.

Recovery / rollback: no state is changed.

When to use it

Use when checking recent crashes, startup errors, HTTP failures, or deployment regressions.

When not to use it

Do not paste raw logs into public channels without reviewing them for secrets or user data.

Watch this command run

Command transcript

This sanitized transcript shows the commands and output shape without exposing host details.

demo@lab:~$

$ docker logs --since 10m --tail 100 api

2026-06-25T14:18:01Z INFO booting api
2026-06-25T14:18:03Z ERROR database connection refused
2026-06-25T14:18:05Z INFO retrying startup

$ docker logs --since 30m --tail 200 api 2>&1 | grep -i 'error\|fail\|exception'

2026-06-25T14:18:03Z ERROR database connection refused
2026-06-25T14:18:05Z fatal startup failed
View commands shown

These are the commands shown in the sanitized transcript.

Commands shown

  1. docker logs --since 10m --tail 100 api
  2. docker logs --since 30m --tail 200 api 2>&1 | grep -i 'error\|fail\|exception'

next steps

Related commands

Web Server Rescue Read-only

Show Published Container Ports

When a service is unreachable, confirm Docker is publishing the port you think it is.

docker port web
Web Server Rescue Can be slow

Inspect Release Disk Usage

Disk pressure during deploys often starts in old release directories.

du -sh releases/* 2>/dev/null | sort -h | tail -10
Web Server Rescue Can be slow

Find Restarting Containers Fast

Restart loops hide in plain sight unless you filter for them.

docker ps -a --filter status=restarting --format 'table {{.Names}}\t{{.Status}}\t{{.Image}}'
Web Server Rescue Can be slow

Find Large Directories with du

Once you know a filesystem is full, the next question is where.

du -xh --max-depth=1 /var 2>/dev/null | sort -h
Study mapping

Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.

  • lpic1:103-gnu-unix-commands
  • lfcs:essential-commands
  • lfcs:networking
  • lfcs:services-logs
  • linuxplus:automation-scripting
  • linuxplus:provisional
  • linuxplus:troubleshooting
  • risk:production-state-change

Useful for

  • LPIC-1 style command-line practice
  • LFCS style performance tasks
  • Linux+ style troubleshooting review

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.