Skip to content
  • Home
  • About
  • No Access
  • Privacy Policy
Bits of .NET
Bits of .NET
  • C#
  • Asp.Net Core
  • SQL
  • Windows
  • WordPress
  • AI
  • JavaScript
  • CSS
  • MORE
    • HTML
    • Ajax
    • Git
    • Docker
    • Kubernetes
    • Photoshop
    • Visual Studio

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • C#
  • Asp.Net Core
  • SQL
  • Windows
  • WordPress
  • AI
  • JavaScript
  • CSS
  • MORE
    • HTML
    • Ajax
    • Git
    • Docker
    • Kubernetes
    • Photoshop
    • Visual Studio
Docker

Docker: Fix a Healthcheck Interval Too Slow to Catch a Crash Loop

- 29.11.26 - ErcanOPAK

🐳 Fix a Healthcheck Interval Too Slow to Catch a Crash Loop

A HEALTHCHECK instruction only gets as many chances to notice trouble as its –interval and –retries allow, and those two numbers compound: an interval of 30 seconds with three retries means a container can be failing for a full 90 seconds or more before Docker ever marks it unhealthy. If the process inside the container has its own internal supervisor quietly restarting a crashing worker thread or sub-process every few seconds, that whole crash loop can run invisibly under the healthcheck’s radar, because by the time three slow checks finally land on a failure, the internal supervisor has already restarted it again and the next check passes.

🔎 The Problem

HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
  CMD curl -f http://localhost:8080/health || exit 1

# App's own process supervisor restarts a crashed worker every ~8 seconds.
# A 30s-interval check has a good chance of landing right after a restart,
# seeing a healthy response, and never accumulating 3 consecutive failures -
# the crash loop runs the entire time the container is "healthy"

✅ Fix: A Healthcheck Interval Too Slow to Catch a Crash Loop

  • Shorten –interval to match how quickly the thing you actually care about can fail and recover, not just a comfortable default, especially for a process with its own internal restart behavior.
  • Add a separate counter or last-crash-timestamp endpoint the healthcheck can query, so a container that’s technically responding right now but has crashed five times in the last minute still gets reported as unhealthy.
  • Pair the Docker-level healthcheck with application-level crash-loop logging, since a fast enough interval only catches it if the check happens to land during the down window in the first place.

🚨 Why This Is Dangerous

  • A container that looks healthy to Docker while silently crash-looping underneath can stay in production serving degraded or inconsistent responses far longer than anyone watching the orchestrator’s status would expect.

A healthcheck’s interval isn’t just a polling frequency — it’s the size of the blind spot between one look and the next.

— DevOps Engineer

Related posts:

Docker: Understand Container Networking Modes

Docker: Understand Container Networking Modes

Docker Builds Are Slow Even with Small Changes

Docker Builds Are Slow Even with Small Changes

Docker: Use Build Secrets to Keep API Keys Out of Images

Docker: Use Build Secrets to Keep API Keys Out of Images

Views: 4
Found this useful? Share it
XLinkedInWhatsApp

Post navigation

The AI Prompt That Finds Unawaited Promises in a Node Script
WordPress: Fix Media Library Thumbnails Breaking After a CDN Switch

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Most Read

  1. 01How to make theater mode the default for Youtube 1,080 views
  2. 02How to add default value for Entity Framework migrations for DateTime and Bool 997 views
  3. 03Get the User Name and Domain Name from an Email Address in SQL 996 views
  4. 04Get the First and Last Word from a String or Sentence in SQL 873 views
  5. 05How to select distinct rows in a datatable in C# 868 views
  6. 06How to enable, disable and check if Service Broker is enabled on a database in SQL Server 672 views
  7. 07Add Constraint to SQL Table to ensure email contains @ 631 views
  8. 08Average of all values in a column that are not zero in SQL 585 views
  9. 09How to use Map Mode for Vertical Scroll Mode in Visual Studio 562 views
Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
Back to top
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com