alert: DockerContainerGone
expr: count by (instance, name) (container_last_seen{name!=""} offset 5m)
unless
count by (instance, name) (container_last_seen{name!=""})
for: 1m
severity: warning
Alert message: Container {{ $labels.name }} is gone ({{ $labels.instance }})
The container was present in the metrics 5 minutes ago, and cAdvisor no longer sees it. The alert stays active for about 5 minutes after the container disappears and then clears on its own, so you need to react quickly.
The container was stopped (docker stop, exit), removed during an update (docker compose up recreated it with a new ID), or crashed and was not restarted (no restart: always).
docker ps -a --filter name=<name>
docker inspect <name> --format '{{.State.Status}} exit={{.State.ExitCode}} oom={{.State.OOMKilled}}'
docker logs --tail 100 <name>
journalctl -u docker -n 50 --no-pager
Start the container (docker start <name> or docker compose up -d), use the logs to understand why it stopped, and if needed set the restart: unless-stopped policy.
When a container is removed or renamed on purpose. For containers that by design live for a short time (jobs), exclude them by the name label.
The full pack of 44 tested rules + Alertmanager → Telegram: 790 ₽ (≈ $9, card payment in rubles)
Open in Telegram · Free Monitoring Lite kit · All runbook alerts