Update automated-cleanup.mdx

This commit is contained in:
peaklabs-dev
2024-10-30 17:02:26 +01:00
parent 564dda22d3
commit c2960fe282

View File

@@ -1,26 +1,52 @@
--- ---
title: "Automated Cleanup" title: "Automated Docker Cleanup"
head: head:
- tag: "meta" - tag: "meta"
attrs: attrs:
property: "og:title" property: "og:title"
content: "How automated cleanups work in Coolify" content: "A guide on how to configure the automated Docker cleanup feature in Coolify and what it does."
description: "A guide on how automated cleanups work in Coolify" description: "A guide on how to configure the automated Docker cleanup feature in Coolify and what it does."
--- ---
Coolify automatically cleans up your servers to prevent them from running out of disk space. It will remove all the unused Docker images, containers, and volumes. import { Aside } from '@astrojs/starlight/components';
## How it works Coolify includes an automated Docker cleanup feature to prevent servers from running out of disk space. This guide explains how to configure it and what it does.
- Coolify will run the cleanup script every 10 minutes. ## Configuration
- If there is an ongoing deployment, the cleanup script will be skipped - to prevent any issues, like deleting the image that is currently being used.
- The cleanup script will remove all the unused Docker images, containers, and volumes with the following commands:
```bash You can configure the automated cleanup under:
# This will remove all unused Docker images `Servers` > `YOUR_SERVER` > `Configuration` > `Advanced`
docker image prune -af
# This will remove all coolify.managed containers that are not running ### Available Settings
docker container prune -f --filter "label=coolify.managed=true"
# This will remove all unused Docker build caches 1. **Docker Cleanup Threshold**
docker builder prune -af - Sets the disk percentage threshold that triggers the cleanup.
``` - Example: If set to 80%, cleanup will be triggered when disk usage exceeds 80%.
2. **Docker Cleanup Frequency**
- Schedule cleanups using [cron expressions](/docs/knowledge-base/cron-syntax) when `Force Docker Cleanup` is enabled.
<Aside type="tip">
- We recommend enabling `Force Docker Cleanup` and scheduling cleanups using cron syntax.
- This provides more reliable cleanup behavior compared to relying on a disk threshold.
</Aside>
3. **Optional Cleanups**
- Enable unused volumes cleanup (note: this can lead to data loss).
- Enable unused networks cleanup.
## How It Works
### Safety Measures
- If there is an ongoing deployment, the cleanup will not be triggered to prevent any issues, like deleting the image that is currently being used.
- Only Coolify-managed resources are affected.
### Cleanup Process
When triggered (either by schedule or disk threshold), the system performs the following actions:
- Removes stopped containers managed by Coolify (no data loss as containers are non-persistent).
- Deletes unused Docker images.
- Clears Docker build cache.
- Removes old versions of Coolify helper images.
- Removes unused Docker volumes (if enabled).
- Removes unused Docker networks (if enabled).