Skip to content

Docker & Podman: Logs

Docker & Podman commands for logs (tags: #logs #cloudwatch).

Index
4 items

Docker3

Docker: Follow logs of a container

Safe

Stream a container's stdout/stderr starting from the last 200 lines.

docker logs -f --tail 200 --timestamps <container>
What each part does
  1. docker logsshow a container's stdout/stderr
  2. -ffollow: keep streaming new lines
  3. --tail 200start with only the last 200 lines
  4. --timestampsprefix each line with its timestamp
  5. <container>container name or ID

Also known as: docker logs -f · container logs

Docker: Show container logs for a time window

Safe

Logs from the last N minutes/hours, e.g. --since 15m or --since 2h.

docker logs --since <duration> <container>
What each part does
  1. docker logsshow a container's output
  2. --since <duration>only lines newer than this: relative (30m, 2h) or a timestamp; pair with --until
  3. <container>container name or ID
Example
$ docker logs --since 15m api

Also known as: logs since

Docker: Follow logs of all compose services

Safe

Interleaved logs from every service in the compose project. Add a service name to narrow it.

docker compose logs -f --tail 100
What each part does
  1. docker compose logslogs of every service in the compose project, prefixed by service name
  2. -ffollow new lines
  3. --tail 100last 100 lines per service to start with

Also known as: docker-compose logs · compose logs

Podman1

Podman: Follow logs of a container

Safe

Stream a container's output starting from the last 200 lines.

podman logs -f --tail 200 <container>
What each part does
  1. podman logsshow a container's output
  2. -ffollow new lines
  3. --tail 200start with the last 200 lines
  4. <container>container name or ID

Also known as: podman logs

My DevOps Playbook by Angelo John Calleja

New runbook

GitHub not connected

Saving is handled by the site: the GitHub token is stored in Cloudflare, not in your browser. Enter the editor password (the EDITOR_PASSWORD secret) to unlock saving in this browser.

Saving commits to gelogrammer/My_DevOps_Playbook. Create a fine-grained token with access to only this repo andContents: Read and write, then paste it here. It is stored only in this browser.

src/content/docs/…