Bash

Tail Logs from Multiple Containers

admin by @admin ADMIN
1d ago
May 31, 2026
Public
0 0 up · 0 down Sign in to vote
`docker compose logs -f` already does this — but the one-liner with --tail and filters is the more useful day-to-day workflow when you only care about recent activity from a subset of services.
Bash
Raw
# Tail recent logs from all services in a compose project
docker compose logs -f --tail=100

# Tail only specific services
docker compose logs -f api worker

# Just errors (grep — drops timestamp colors but works in any shell)
docker compose logs -f --no-color | grep -i 'error\|warn\|fatal'

# Tail a specific running container by name
docker logs -f --tail=200 myapp_web_1

# Find a container ID quickly
docker ps --format '{{.ID}}\t{{.Names}}\t{{.Status}}' | column -t

# Save the last 5 minutes of logs to a file
docker logs --since 5m myapp_web_1 > web-recent.log
Tags

Save your own code snippets

Create a free account and build your private vault. Share publicly whenever you want.