diff --git a/docker-healthcheck.py b/docker-healthcheck.py index b046567..5b71c57 100644 --- a/docker-healthcheck.py +++ b/docker-healthcheck.py @@ -29,7 +29,11 @@ def main() -> None: container = client.containers.get(container_id) container_status = container.attrs["State"]["Status"] if container_status in ["healthy", "running"]: - requests.post(checks[container_id]) + retry_count = 0 + while requests.post(checks[container_id]).content != b'OK': + if retry_count > 10: + print(f"error posting to '{container_id}' with url '{checks[container_id]}'") + retry_count += 1 else: requests.post( checks[container_id] + "/fail",