From 579f8ef99607942ee079e66dab637ef012f8fc61 Mon Sep 17 00:00:00 2001 From: Joshua <1041261+JoshuaACasey@users.noreply.github.com> Date: Fri, 18 Apr 2025 23:20:04 -0500 Subject: [PATCH 1/4] Update .bashrc make docker-clean alias better at cleaning --- .bashrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.bashrc b/.bashrc index 5378cd2..d8469dd 100644 --- a/.bashrc +++ b/.bashrc @@ -255,7 +255,10 @@ alias docker-clean=' \ docker container prune -f ; \ docker image prune -f ; \ docker network prune -f ; \ - docker volume prune -f ' + docker volume prune -f ; \ + docker rm -vf $(docker ps -aq) ; \ + docker rmi -f $(docker images -aq) ; \ + docker system prune -a -f ' ####################################################### # SPECIAL FUNCTIONS From b043d6008ac04b794b938742126aac1dccf23f9a Mon Sep 17 00:00:00 2001 From: Joshua <1041261+JoshuaACasey@users.noreply.github.com> Date: Sat, 19 Apr 2025 00:47:19 -0500 Subject: [PATCH 2/4] Update .bashrc add even more docker cleaning power --- .bashrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.bashrc b/.bashrc index d8469dd..baeb29c 100644 --- a/.bashrc +++ b/.bashrc @@ -255,7 +255,9 @@ alias docker-clean=' \ docker container prune -f ; \ docker image prune -f ; \ docker network prune -f ; \ - docker volume prune -f ; \ + docker volume prune -f ' + +alias docker-clean-ext=' \ docker rm -vf $(docker ps -aq) ; \ docker rmi -f $(docker images -aq) ; \ docker system prune -a -f ' From d29742fd666734976d61bb783e9e0b71d615cd97 Mon Sep 17 00:00:00 2001 From: Joshua <1041261+JoshuaACasey@users.noreply.github.com> Date: Sat, 19 Apr 2025 00:49:11 -0500 Subject: [PATCH 3/4] Update .bashrc --- .bashrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bashrc b/.bashrc index baeb29c..01ac5a6 100644 --- a/.bashrc +++ b/.bashrc @@ -257,7 +257,7 @@ alias docker-clean=' \ docker network prune -f ; \ docker volume prune -f ' -alias docker-clean-ext=' \ +alias docker-nuke=' \ docker rm -vf $(docker ps -aq) ; \ docker rmi -f $(docker images -aq) ; \ docker system prune -a -f ' From d71993ea0b170d28903b9a0ced7281eead22e7ae Mon Sep 17 00:00:00 2001 From: Joshua <1041261+JoshuaACasey@users.noreply.github.com> Date: Sun, 20 Apr 2025 20:58:49 -0500 Subject: [PATCH 4/4] made docker-clean more cleany --- .bashrc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.bashrc b/.bashrc index 01ac5a6..3b993eb 100644 --- a/.bashrc +++ b/.bashrc @@ -249,18 +249,21 @@ alias clickpaste='sleep 3; xdotool type "$(xclip -o -selection clipboard)"' alias kssh="kitty +kitten ssh" -# alias to cleanup unused docker containers, images, networks, and volumes +# alias to cleanup unused docker containers, images, networks, and volumes and includes the "nuke" option to cleanup active containers alias docker-clean=' \ docker container prune -f ; \ docker image prune -f ; \ docker network prune -f ; \ - docker volume prune -f ' - -alias docker-nuke=' \ - docker rm -vf $(docker ps -aq) ; \ - docker rmi -f $(docker images -aq) ; \ - docker system prune -a -f ' + docker volume prune -f ; \ + if [ -n "$(docker images -aq)" ]; then \ + docker rmi -f $(docker images -aq) ; \ + fi ; \ + read -p "Are you sure you want to remove ALL running containers? (y/n): " confirm; \ + if [ "$confirm" = "y" ]; then \ + docker rm -vf $(docker ps -aq); \ + fi ; \ + docker system prune -a -f' ####################################################### # SPECIAL FUNCTIONS