From 8458d9e0f6088f1778e4a6ea28e4ee6b91dd44b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Tue, 26 Oct 2021 17:43:02 +0200 Subject: [PATCH] Only get stats for running containers (#3268) --- supervisor/docker/interface.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/supervisor/docker/interface.py b/supervisor/docker/interface.py index 76c87c149..616e5a270 100644 --- a/supervisor/docker/interface.py +++ b/supervisor/docker/interface.py @@ -528,6 +528,10 @@ class DockerInterface(CoreSysAttributes): except (docker.errors.DockerException, requests.RequestException) as err: raise DockerError() from err + # container is not running + if docker_container.status != "running": + raise DockerError(f"Container {self.name} is not running", _LOGGER.error) + try: stats = docker_container.stats(stream=False) return DockerStats(stats)