mirror of
https://github.com/kossakovsky/n8n-install.git
synced 2026-03-07 14:23:08 +00:00
fix(cleanup): preserve volumes in make clean, add make clean-all
This commit is contained in:
11
Makefile
11
Makefile
@@ -1,4 +1,4 @@
|
||||
.PHONY: help install update update-preview clean logs status monitor restart show-restarts doctor switch-beta switch-stable
|
||||
.PHONY: help install update update-preview clean clean-all logs status monitor restart show-restarts doctor switch-beta switch-stable
|
||||
|
||||
PROJECT_NAME := localai
|
||||
|
||||
@@ -8,7 +8,8 @@ help:
|
||||
@echo " make install Full installation"
|
||||
@echo " make update Update system and services"
|
||||
@echo " make update-preview Preview available updates (dry-run)"
|
||||
@echo " make clean Remove unused Docker resources"
|
||||
@echo " make clean Remove unused Docker resources (preserves data)"
|
||||
@echo " make clean-all Remove ALL Docker resources including data (DANGEROUS)"
|
||||
@echo ""
|
||||
@echo " make logs View logs (all services)"
|
||||
@echo " make logs s=<service> View logs for specific service"
|
||||
@@ -33,6 +34,12 @@ update-preview:
|
||||
clean:
|
||||
sudo bash ./scripts/docker_cleanup.sh
|
||||
|
||||
clean-all:
|
||||
@echo "WARNING: This will delete ALL Docker resources including application data!"
|
||||
@echo "Press Ctrl+C to cancel, or wait 10 seconds to continue..."
|
||||
@sleep 10
|
||||
docker system prune -a --volumes -f
|
||||
|
||||
logs:
|
||||
ifdef s
|
||||
docker compose -p $(PROJECT_NAME) logs -f --tail=200 $(s)
|
||||
|
||||
@@ -1,38 +1,29 @@
|
||||
#!/bin/bash
|
||||
# =============================================================================
|
||||
# docker_cleanup.sh - Complete Docker system cleanup
|
||||
# docker_cleanup.sh - Docker system cleanup (preserves volumes)
|
||||
# =============================================================================
|
||||
# Aggressively cleans up the Docker system to reclaim disk space.
|
||||
# WARNING: This action is irreversible!
|
||||
# Cleans up the Docker system to reclaim disk space.
|
||||
#
|
||||
# Removes:
|
||||
# - All stopped containers
|
||||
# - All networks not used by at least one container
|
||||
# - All unused images (not just dangling ones)
|
||||
# - All unused volumes
|
||||
# - All build cache
|
||||
#
|
||||
# Preserves:
|
||||
# - All volumes (to protect application data like Redis, PostgreSQL, etc.)
|
||||
#
|
||||
# Usage: make clean OR sudo bash scripts/docker_cleanup.sh
|
||||
# =============================================================================
|
||||
|
||||
set -e
|
||||
|
||||
# Source the utilities file
|
||||
source "$(dirname "$0")/utils.sh"
|
||||
|
||||
log_info "Starting Docker cleanup..."
|
||||
|
||||
# The 'docker system prune' command removes:
|
||||
# - all stopped containers
|
||||
# - all networks not used by at least one container
|
||||
# - all "dangling" (unreferenced) images
|
||||
# - all build cache
|
||||
#
|
||||
# Additional flags:
|
||||
# -a, --all: Remove all unused images, not just dangling ones.
|
||||
# --volumes: Remove all unused volumes.
|
||||
# -f, --force: Do not prompt for confirmation.
|
||||
# Clean containers, networks, images, and build cache
|
||||
# NOTE: --volumes flag removed to preserve application data
|
||||
docker system prune -a -f
|
||||
|
||||
docker system prune -a --volumes -f
|
||||
|
||||
log_success "Docker cleanup completed successfully."
|
||||
log_success "Docker cleanup completed. Volumes preserved."
|
||||
|
||||
Reference in New Issue
Block a user