diff --git a/.bashrc b/.bashrc index 5378cd2..3b993eb 100644 --- a/.bashrc +++ b/.bashrc @@ -249,13 +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 ' + 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