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: watch docker events to see exactly when a container dies

Docker
~/tips/tip-docker-events-die

docker events --filter 'event=die' --filter 'type=container'

Streams a line every time a container exits, with its exit code, so restarts are easy to spot.

A container keeps restarting and the logs say nothing useful. Before you dig through logs, watch what the daemon itself reports.

docker events streams what happens on the host: starts, stops, kills, health changes. Add a filter to cut the noise.

docker events --filter 'event=die' --filter 'type=container'

Each time a container exits you see a line with its name and an exit code in the attributes. Combine --since 10m to look back a little, and --format '{{json .}}' if you want JSON lines for a script. Exit code 137 means it was killed, which often points at the out-of-memory killer.

It is a decent companion to docker logs. The logs tell you what the app said, and the events tell you what Docker did about it: die, kill, oom, restart, health_status.

The caveat is memory. The daemon only keeps the most recent 256 events, so an old crash may already be gone. Without --since you only see new events from the moment you start. Also, repeating the same filter key acts as OR, while different keys act as AND.

Further reading: docker system events, On this site: docker diff shows what a container changed in its filesystem, On this site: docker ps –format table gives you a readable overview, On this site: 🐳Comprehensive Guide: Updating Docker Containers via the Unraid Terminal

Going deeper: Keep a domain pointed at your home with Cloudflare DDNS on Unraid

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