mirror of
https://github.com/kossakovsky/n8n-install.git
synced 2026-03-07 14:23:08 +00:00
30 lines
974 B
Bash
Executable File
30 lines
974 B
Bash
Executable File
#!/bin/bash
|
|
# =============================================================================
|
|
# docker_cleanup.sh - Docker system cleanup (preserves volumes)
|
|
# =============================================================================
|
|
# 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 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 "$(dirname "$0")/utils.sh"
|
|
|
|
log_info "Starting Docker cleanup..."
|
|
|
|
# Clean containers, networks, images, and build cache
|
|
# NOTE: --volumes flag removed to preserve application data
|
|
docker system prune -a -f
|
|
|
|
log_success "Docker cleanup completed. Volumes preserved."
|