Русская версия

DockerContainerGone: what to do when it fires

Alert rule

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 }})

What it means

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.

Common causes

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).

Diagnostics

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

How to fix

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 it is OK to silence

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.

Related alerts

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