diff --git a/services/docker.py b/services/docker.py index 1b88720..2f8f1be 100644 --- a/services/docker.py +++ b/services/docker.py @@ -101,6 +101,17 @@ async def docker_cmd(args: list[str], timeout: int = 20): async def docker_watchdog(container_map, notify, bot, chat_id): last = {} while True: + if not last: + for alias, real in container_map.items(): + rc, state = await docker_cmd( + ["inspect", "-f", "{{.State.Status}}", real], + timeout=10 + ) + if rc != 0: + state = "error" + last[alias] = state.strip() + await asyncio.sleep(120) + continue for alias, real in container_map.items(): rc, state = await docker_cmd( ["inspect", "-f", "{{.State.Status}}", real],