Skip to content

lkroliko/HealthCheck

Repository files navigation

HealthChecks.Container.Client

.NET 10 NuGet License: MIT

Lightweight health check client for .NET containerized applications — no curl needed.

🔍 Problem

In newer versions of Microsoft container images (including chiseled variants), you can't simply install curl to check the status of your app. So how do you run health checks?

✅ Solution

1. Install the NuGet package

dotnet add package MrRabbit.HealthChecks.Container.Client

2. Configure docker-compose.yml

healthcheck:
  test: ["CMD", "dotnet", "/[PATH TO YOUR APP]/healthcheck.dll", "ADDRESS TO HEALTH CHECK ENDPOINT"]

Example:

healthcheck:
  test: ["CMD", "dotnet", "/app/healthcheck.dll", "http://localhost:8080/hc"]

💡 Works with chiseled container images too!

🔧 How it works

The NuGet package adds content files that are copied to the build output directory:

healthcheck.dll
healthcheck.runtimeconfig.json

You can also run it manually from a terminal inside the container:

dotnet ./healthcheck.dll http://localhost:8080/hc

📖 Sample

➡️ Sample web app

📋 Changelog

Version Changes
10.0.0 Added support for .NET 10
9.0.1 Removed linux-x64 runtime compilation for Any CPU support
9.0.0 Added support for .NET 9
8.0.0 First release

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors