Skip to content

PruneMate - Docker image & resource cleanup helper, on a schedule!

License

Notifications You must be signed in to change notification settings

0x20Fearless/prunemate

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PruneMate

prunemate-logo

PruneMate

Docker image & resource cleanup helper, on a schedule!

A sleek, lightweight web interface to automatically clean up Docker resources on a schedule. Built with Python (Flask) Β· Docker SDK Β· APScheduler Β· Gunicorn

Keep your Docker host tidy with scheduled cleanup of unused images, containers, networks, and volumes.


✨ Features

  • πŸ• Flexible scheduling - Daily, Weekly, or Monthly cleanup runs
  • 🌍 Timezone aware - Configure your local timezone
  • πŸ•’ 12/24-hour time format - Choose your preferred time display
  • 🧹 Selective cleanup - Choose what to prune: containers, images, networks, volumes
  • πŸ”” Smart notifications - Gotify or ntfy.sh support with optional change-only alerts
  • 🎨 Modern UI - Dark theme with smooth animations and responsive design
  • πŸ”’ Safe & controlled - Manual trigger option and detailed logging
  • πŸ“Š Detailed reports - See exactly what was cleaned and how much space was reclaimed

πŸ“· Screenshots

Main Dashboard

The overall look and feel of the PruneMate dashboard

Main Dashboard - Schedule Configuration

Configure when and how often PruneMate should clean up your Docker resources.

prunemate-schedule

Cleanup Options & Settings

Select which Docker resources to clean up and configure advanced options.

prunemate-cleanup

Notification Settings

Set up notifications via Gotify or ntfy.sh to stay informed about cleanup results.

prunemate-notifications

prunemate-notifications

Cleanup Results

Get detailed statistics notifications about what was cleaned and how much space was reclaimed.

Gotify :

prunemate-results

ntfy :

prunemate-results


🐳 Docker Compose Configuration

docker-compose.yaml:

services:
  prunemate:
    image: anoniemerd/prunemate:latest
    ports:
      - "7676:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./logs:/var/log
      - ./config:/config
    environment:
      - PRUNEMATE_TZ=Europe/Amsterdam # Change this to your desired timezone
      - PRUNEMATE_TIME_24H=true #false for 12-Hour format (AM/PM)
    restart: unless-stopped

Volume explanations:

  • /var/run/docker.sock - Required for Docker API access
  • ./logs - Stores application logs (rotating, 5MB max per file)
  • ./config - Stores configuration and state files

βš™οΈ Configuration

Environment Variables

Variable Default Description
PRUNEMATE_TZ UTC Timezone for scheduling (e.g., Europe/Amsterdam, America/New_York)
PRUNEMATE_TIME_24H true Time format: true for 24-hour, false for 12-hour (AM/PM)
PRUNEMATE_CONFIG /config/config.json Path to configuration file

Web Interface Settings

Access the web interface at http://localhost:7676/ (or your server IP) to configure:

Schedule Settings:

  • Frequency: Daily, Weekly, or Monthly
  • Time: When to run the cleanup (supports both 12h and 24h format)
  • Day: Day of week (for weekly) or day of month (for monthly)

Cleanup Options:

  • β˜‘οΈ All unused containers
  • β˜‘οΈ All unused images
  • β˜‘οΈ All unused networks
  • β˜‘οΈ All unused volumes

Notification Settings:

  • Provider: Gotify or ntfy.sh
  • URL: Your notification server URL
  • Token/Topic: Authentication token (Gotify) or topic name (ntfy)
  • Only notify on changes: Only send notifications when something was actually cleaned

🧠 How it works

  1. Scheduler runs every minute checking if it's time to execute
  2. Loads latest config from persistent storage
  3. Executes Docker prune commands for selected resource types
  4. Collects statistics on what was removed and space reclaimed
  5. Sends notification (if configured and enabled)
  6. Logs everything with timezone-aware timestamps

File Structure

/config/
β”œβ”€β”€ config.json          # Your configuration (persistent)
β”œβ”€β”€ prunemate.lock       # Prevents concurrent runs
└── last_run_key         # Tracks last successful run

/var/log/
└── prunemate.log        # Application logs (rotating, 5MB max)

πŸ”” Notification Setup

Gotify

Gotify is a self-hosted notification service.

Setup steps:

  1. Install and run Gotify server
  2. Create a new application in Gotify
  3. Copy the application token
  4. Configure in PruneMate:
    • Provider: Gotify
    • URL: https://your-gotify-server.com
    • Token: Your application token

ntfy.sh

ntfy.sh is a simple pub-sub notification service (self-hosted or public).

Setup steps:

  1. Choose a unique topic name (e.g., prunemate-alerts)
  2. Configure in PruneMate:
    • Provider: ntfy
    • URL: https://ntfy.sh (your self-hosted instance)
    • Topic: Your chosen topic name

Subscribe to notifications:

  • Web: Visit https://ntfy.sh/your-topic
  • Mobile: Install the ntfy app (Android / iOS) and subscribe to your topic
  • Desktop: Use ntfy desktop app or web browser

🧠 Troubleshooting

Problem Solution
❌ Can't access web interface β€’ Check if port 7676 is available and not blocked by firewall
β€’ Verify container is running: docker ps
β€’ Check logs: docker logs prunemate
βš™οΈ Container not starting β€’ View startup errors: docker logs prunemate
β€’ Verify Docker socket is accessible
β€’ Check if port 7676 is already in use
πŸ”’ Permission denied errors β€’ Ensure /var/run/docker.sock exists and is accessible
β€’ On Linux, Docker daemon must be running
β€’ User running Docker must have proper permissions
πŸ• Wrong timezone in logs/schedule β€’ Set PRUNEMATE_TZ environment variable correctly
β€’ Restart container after changing: docker-compose restart
β€’ Verify timezone in logs matches expected
πŸ“§ Notifications not working β€’ Test notification settings in web interface
β€’ Verify notification server URL is accessible
β€’ Check token/topic is correct
β€’ Review logs for error messages
πŸ—‚οΈ Configuration not persisting β€’ Ensure ./config volume is mounted correctly
β€’ Check file permissions on host ./config directory
β€’ Verify container has write access
🧹 Cleanup not running on schedule β€’ Check schedule configuration in web interface
β€’ Verify timezone is set correctly
β€’ Review logs: "Next scheduled run" messages
β€’ Ensure container is running continuously

Logging

What the logs contain:

  • βœ… Scheduler heartbeats (every minute)
  • πŸ“ Configuration changes
  • 🧹 Prune job executions with results
  • πŸ“¨ Notification delivery status
  • ❌ Error messages and warnings

πŸ“ Changelog

Version 1.2.2 (November 2025)

  • ✨ Added 12/24-hour time format support via PRUNEMATE_TIME_24H environment variable
  • 🌍 Improved timezone handling across all components (logs, scheduling, notifications)
  • 🎨 Enhanced UI with custom time picker for 12-hour mode (hour 1-12, minutes, AM/PM selector)
  • πŸ› Fixed config synchronization issues in multi-worker setup
  • ⚑ Simplified architecture: reduced from 2 workers to 1 for better reliability
  • πŸ“ Implemented silent config loading to reduce log noise
  • πŸ”§ Improved input validation with instant clamping and 2-digit limits
  • πŸ”’ Added thread-safe configuration saving with file locking

Version 1.2.1 (November 2025)

  • πŸ› Fixed scheduler not triggering at configured times
  • πŸ”„ Config now reloads before each scheduled check to ensure synchronization
  • πŸ”’ Added thread-safe config saving mechanism
  • πŸ“Š Improved logging with timezone-aware timestamps

Version 1.2.0 (November 2025)

  • πŸ”” Added notification support (Gotify & ntfy.sh)
  • 🎨 Complete UI redesign with modern dark theme
  • πŸ“Š Enhanced statistics and detailed cleanup reporting
  • 🎯 Added "only notify on changes" option
  • πŸ”˜ Improved button animations and hover effects

Version 1.1.0 (October 2025)

  • πŸŽ‰ Initial release
  • πŸ• Daily, Weekly, and Monthly scheduling
  • 🧹 Selective cleanup options (containers, images, networks, volumes)
  • 🌐 Web interface for configuration
  • πŸ“ Persistent configuration and logging

πŸ“¬ Support

Have questions or need help?


πŸ‘€ Author & License

Author: Anoniemerd
πŸ™ GitHub: https://github.com/anoniemerd
πŸ“¦ Repository: https://github.com/anoniemerd/PruneMate

License: MIT License
Β© 2025 – PruneMate Project


Keep your Docker host clean with PruneMate! 🐳🧹

About

PruneMate - Docker image & resource cleanup helper, on a schedule!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 51.6%
  • Python 47.8%
  • Dockerfile 0.6%