From c2960fe282f70037f0cdc006de5036a2e7251de2 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Wed, 30 Oct 2024 17:02:26 +0100 Subject: [PATCH] Update automated-cleanup.mdx --- .../server/automated-cleanup.mdx | 58 ++++++++++++++----- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/src/content/docs/knowledge-base/server/automated-cleanup.mdx b/src/content/docs/knowledge-base/server/automated-cleanup.mdx index 57971c0..b9dee12 100644 --- a/src/content/docs/knowledge-base/server/automated-cleanup.mdx +++ b/src/content/docs/knowledge-base/server/automated-cleanup.mdx @@ -1,26 +1,52 @@ --- -title: "Automated Cleanup" +title: "Automated Docker Cleanup" head: - tag: "meta" attrs: property: "og:title" - content: "How automated cleanups work in Coolify" -description: "A guide on 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 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. -- 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: +## Configuration -```bash -# This will remove all unused Docker images -docker image prune -af -# This will remove all coolify.managed containers that are not running -docker container prune -f --filter "label=coolify.managed=true" -# This will remove all unused Docker build caches -docker builder prune -af -``` +You can configure the automated cleanup under: +`Servers` > `YOUR_SERVER` > `Configuration` > `Advanced` + +### Available Settings + +1. **Docker Cleanup Threshold** + - 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. + + + +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).