RCA-2026-03-17-001: Prevention

Preventive Measures

Short-term

Action Owner Status

Document cleanup command in CLAUDE.md

Evan

[x] Done (this RCA)

Add alias for quick cleanup

Evan

[ ] Pending

Suggested alias:

alias kroki-stop='docker ps -q --filter "name=domus-kroki" | xargs -r docker stop'

Note: -r prevents xargs from running if input is empty.

Long-term

Action Owner Status

Add kroki-stop to spoke repo Makefiles

Evan

[ ] Pending

Consider using --rm flag when starting containers

Evan

[ ] Investigate

Detection

How was it detected?

Manual observation via docker ps.

Detection Gap

Could add periodic check:

# Add to cron or shell startup
docker ps --filter "name=domus-kroki" --format "WARNING: {{.Names}} running for {{.RunningFor}}" | grep -q "hours\|days" && echo "Orphan Kroki containers detected"

Lessons Learned

What went well

  • Quick identification via docker ps

  • Clean one-liner solution with xargs

Key Takeaways

  1. xargs converts stdin to arguments - perfect for docker stop which takes multiple IDs

  2. Filter patterns - --filter "name=pattern" targets containers by name prefix

  3. Build hygiene - always use Makefile targets that include cleanup

  4. -q for IDs only - many docker commands have quiet mode for scripting