Most of the problems on a small self-hosted box are not dramatic. They are quiet:

  • a backup cron that has been sending its output to /dev/null for months,
  • Postgres published on 0.0.0.0 while you believe UFW is protecting it (Docker often bypasses the host firewall),
  • a certificate that expires next week,
  • a container that is a few tags behind,
  • a disk that is already at 93%.

Each one has its own tool, and I have written about a few of them here separately. What I wanted was one command I could run on a single Linux host that looks at all five, prints a plain OK / WARN / FAIL report, and exits non-zero so cron can notice. So I built it: homelab-doctor. Disclosure: it's my tool, free and MIT.

What it looks like

There's an offline demo with sample data (no Docker, no network, nothing changed):

python3 homelab_doctor.py --demo 
Ports FAIL docker:postgres 0.0.0.0:5432/tcp published on all interfaces; UFW is active (Docker often bypasses the host firewall) WARN sshd 0.0.0.0:22/tcp listening on all interfaces OK docker:gitea 127.0.0.1:3000/tcp published on loopback only Cron FAIL /etc/cron.d/backup 0 3 * * * /opt/backup.sh >/dev/null 2>&1 stdout and stderr go to /dev/null, no alert in the command WARN user crontab 0 4 * * * backup.sh no PATH in this crontab, command is not an absolute path FAIL /etc/cron.d/sync 0 5 * * * /usr/local/bin/sync.sh script is not executable: /usr/local/bin/sync.sh 

(The demo also prints Images, Certificates and Disk sections; trimmed here.)

The five checks

Check Looks at Typical WARN / FAIL
images Running containers vs the public registry (digest + newer version tag) new digest for your tag, or a newer tag exists
ports ss (or /proc/net/tcp) and Docker's published ports FAIL if Docker published on all interfaces and UFW/firewalld is active
certs TLS certs for hosts you pass with --cert or --certs-file WARN within 30 days, FAIL within 7 or expired
cron /etc/crontab, /etc/cron.d/*, readable user crontabs output to /dev/null with no alerter, non-executable script, missing PATH
disk Real filesystems, plus Docker disk usage when the socket is readable WARN at 80%, FAIL at 90% (configurable)

Newer image tags are matched in the same style as the one you run: 16-alpine is compared with N-alpine, v2.10.4 with vX.Y.Z. Public images only, anonymous access, no credentials read or sent.

Design choices

  • Read-only, on purpose. It never pulls images, restarts containers, edits firewall rules, renews certificates or deletes files. Image checks are only GET requests to the Docker socket plus anonymous HEAD/tag-list calls to registries; no layers are downloaded.
  • One file, Python 3.9+ standard library only. Nothing to install on the box besides the script.
  • Exit codes for cron: 0 nothing to flag, 1 at least one WARN or FAIL, 2 bad arguments or no check could run.
# every morning at 07:00, keep the last report 0 7 * * * /usr/bin/python3 /opt/homelab_doctor.py --certs-file /etc/homelab-doctor-certs.txt >> /var/log/homelab-doctor.txt 2>&1 

What it doesn't do

I'd rather be upfront about the limits:

  • No alerts of its own (no webhook, ntfy or email) and no --json. You pipe the exit code into whatever you already use.
  • The port check is best-effort, not a full iptables / nftables audit of the DOCKER-USER chain.
  • The cron check is a heuristic: it spots silent-fail patterns, it can't tell you whether last night's job actually failed.
  • One local host, public registries only, Unix-socket Docker only (rootless works with --socket). It doesn't replace a monitoring stack.

What would you add as a sixth check for a single self-hosted box? I keep going back and forth between "backup file is older than N hours" and "SMART disk health".

pip install homelab-doctor · https://github.com/alessio1999xx-debug/homelab-doctor-lite