brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: docker compose logs --since 10m shows only what just happened

Docker
~/tips/compose-logs-since

docker compose logs --since 10m -f -n 50 sonarr

Shows only what your Docker Compose stack logged in the last few minutes.

When something breaks I used to run docker compose logs and stare at a wall of text from last Tuesday. Now I ask for only the last few minutes, and the error is usually right there.

Docker’s own docs list a --since flag for docker compose logs. It takes a timestamp or a relative time, so 10m means the last ten minutes. Add -f to keep following and -n (or --tail) to cap the lines per container:

docker compose logs --since 10m -f -n 50 sonarr

Leave the service name off and you get every service in the stack. Add -t if you want a timestamp on each line, which helps when you try to match an error to the moment you clicked something.

One caveat: it only reads what the container’s log driver still keeps. If you rotate logs aggressively, older lines are gone, so --since 2d will not bring them back. It is also read-only, so nothing here can hurt your stack. Check your Compose version with docker compose version if the flag is not recognised.

Further reading: docker compose logs (Docker docs), On this site: docker logs –since 10m -f shows only what just happened, On this site: docker compose run –rm gives you a one-off command that cleans up after itself

More Docker tips ONBUILD RUN /usr/local/bin/python-build --dir /app/src SHELL ["/bin/bash", "-c"] docker commit <container> myname/testimage:version3 docker import /path/to/exampleimage.tgz docker compose events All Docker tips (192) All topics

Link