From 88575aaa4389efd57833d2fbbb8773294937e2e8 Mon Sep 17 00:00:00 2001 From: Yury Kossakovsky Date: Wed, 6 Aug 2025 10:43:09 -0600 Subject: [PATCH] Enhance docker_cleanup.sh with logging and error handling - Added error handling with 'set -e' to ensure the script exits on errors. - Integrated logging functions for starting and completing the Docker cleanup process, improving visibility and tracking of script execution. --- scripts/docker_cleanup.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/docker_cleanup.sh b/scripts/docker_cleanup.sh index 11b9114..6a1e997 100755 --- a/scripts/docker_cleanup.sh +++ b/scripts/docker_cleanup.sh @@ -1,10 +1,15 @@ #!/bin/bash +set -e + +# Source the utilities file +source "$(dirname "$0")/utils.sh" + # This script is intended for cleaning up the Docker system. # It removes all unused containers, images, networks, and volumes. # Use with caution, as this action is irreversible. -echo "Starting Docker cleanup..." +log_info "Starting Docker cleanup..." # The 'docker system prune' command removes: # - all stopped containers @@ -19,5 +24,4 @@ echo "Starting Docker cleanup..." docker system prune -a --volumes -f -echo "Docker cleanup completed successfully." - +log_success "Docker cleanup completed successfully." \ No newline at end of file