Skip to content

Commit d71993e

Browse files
authored
made docker-clean more cleany
1 parent d29742f commit d71993e

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

.bashrc

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,18 +249,21 @@ alias clickpaste='sleep 3; xdotool type "$(xclip -o -selection clipboard)"'
249249

250250
alias kssh="kitty +kitten ssh"
251251

252-
# alias to cleanup unused docker containers, images, networks, and volumes
252+
# alias to cleanup unused docker containers, images, networks, and volumes and includes the "nuke" option to cleanup active containers
253253

254254
alias docker-clean=' \
255255
docker container prune -f ; \
256256
docker image prune -f ; \
257257
docker network prune -f ; \
258-
docker volume prune -f '
259-
260-
alias docker-nuke=' \
261-
docker rm -vf $(docker ps -aq) ; \
262-
docker rmi -f $(docker images -aq) ; \
263-
docker system prune -a -f '
258+
docker volume prune -f ; \
259+
if [ -n "$(docker images -aq)" ]; then \
260+
docker rmi -f $(docker images -aq) ; \
261+
fi ; \
262+
read -p "Are you sure you want to remove ALL running containers? (y/n): " confirm; \
263+
if [ "$confirm" = "y" ]; then \
264+
docker rm -vf $(docker ps -aq); \
265+
fi ; \
266+
docker system prune -a -f'
264267

265268
#######################################################
266269
# SPECIAL FUNCTIONS

0 commit comments

Comments
 (0)