32 lines
1.2 KiB
Markdown
32 lines
1.2 KiB
Markdown
# Image Cleanup
|
|
|
|
This repository manages a simple maintenance utility used to keep the server's Docker environment clean. It prevents disk space exhaustion by removing unused data.
|
|
|
|
## 🛠️ Functionality
|
|
|
|
The service executes a deep cleanup of the Docker system using the following command:
|
|
|
|
```bash
|
|
docker system prune -af --volumes
|
|
```
|
|
|
|
This command removes:
|
|
- All stopped containers.
|
|
- All networks not used by at least one container.
|
|
- All images without at least one container associated with them.
|
|
- All build cache.
|
|
- All unused volumes.
|
|
|
|
## 📅 Automation Schedule
|
|
|
|
The cleanup is managed by Woodpecker CI and is triggered in two ways:
|
|
- Weekly Cron: A scheduled task that runs once a week to ensure the host doesn't accumulate "cruft" over time.
|
|
- Manual Push: Any push to the main branch will trigger an immediate cleanup, allowing for on-demand maintenance.
|
|
|
|
## 📂 Repository Structure
|
|
|
|
.woodpecker.yaml: Defines the cleanup logic and the triggers (cron and push events).
|
|
|
|
## ⚠️ Important Note
|
|
|
|
Since this service uses the -a (all) and --volumes flags, it is very thorough. Ensure that any data you wish to persist is explicitly mapped to a persistent volume or handled by a running container, as unreferenced volumes will be purged. |