BashadvanceddevopsAI generated

Container Health-Check Daemon

A long-running Bash daemon that polls Docker container health via docker inspect, restarts unhealthy containers according to a policy, and exposes a simple status file consumable by other tools. Learners practice daemonization patterns, signal handling, and integrating with the Docker CLI.

Estimate
~10.5h
Steps
6
Completed by
0
Proposed by
codeseed.app

Docker CLI · systemd · jq

Project roadmap

  1. 01

    Write the polling loop core

    ~2h

    Write a loop that runs docker inspect on a set of containers and parses health status with jq.

  2. 02

    Implement restart policy logic

    ~2.5h

    Add configurable rules (max restarts per hour, backoff delay) before restarting an unhealthy container.

  3. 03

    Add signal handling for graceful shutdown

    ~1.5h

    Trap SIGTERM/SIGINT to finish the current check cycle and clean up before exiting.

  4. 04

    Expose a status file for external consumers

    ~1.5h

    Write current container health states to a JSON status file that other scripts or dashboards can read.

  5. 05

    Package as a systemd service

    ~1.5h

    Write a systemd unit file so the daemon starts on boot, restarts on crash, and logs via journald.

  6. 06

    Add basic alerting on repeated failures

    ~1.5h

    Send a notification (webhook or email) when a container exceeds its restart budget.

Ready to build this?

Get a GitHub repo and start building. Your AI reviewer checks each step as you go.

~10.5h · 6 steps

Tech stack

Docker CLIsystemdjq